Draw circle with UIBezierPath

后端 未结 3 932
野趣味
野趣味 2020-12-08 22:45

I\'m trying to draw a circle using UIBezierPath addArcWithCenter method :

UIBezierPath *bezierPath = 
  [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0.,         


        
3条回答
  •  轮回少年
    2020-12-08 23:21

    startAngle:degreesToRadians(-90) endAngle:0 clockwise:YES
    

    (The reason is that the default coordinate system on iOS has a x-axis pointing to the right, and a y-axis pointing down.)

    read this document https://developer.apple.com/library/ios/documentation/uikit/reference/UIBezierPath_class/index.html

    specifying a start angle of 0 radians, an end angle of π radians, and setting the clockwise parameter to YES draws the bottom half of the circle. However, specifying the same start and end angles but setting the clockwise parameter set to NO draws the top half of the circle.

提交回复
热议问题