1
我想在圆上画一条直线(截取圆的圆弧),就像在图片中一样。如何绘制垂直于圆弧的直线(Core Graphics)?
我使用这个代码来绘制圆
let center = CGPoint(x: bounds.width/2, y: bounds.height/2)
let path = UIBezierPath(arcCenter: center, radius: radius, startAngle: Conversion.degreesToRadians(value: CGFloat(0)), endAngle: Conversion.degreesToRadians(value: CGFloat(360)), clockwise: true)
path.lineWidth = 2
path.lineCapStyle = CGLineCap.square
UIColor.white.setStroke()
path.stroke()
问题如何做CoreGraphics? (通常,你甚至不会使用CoreGraphics,而是'笔画''UIBezierPath'或者添加一个'CAShapeLayer')。或者,如何计算这些线段的起点和终点,这个问题是数学背后的问题?你知道如何画圆圈吗?事实上,这个问题太广泛了。 – Rob
把你的代码绘制圆,也从哪里放线 –
如何确定这些线段的起点和终点? –