Draw ellipse with start and end angle in Objective-C

前端 未结 3 1314
轻奢々
轻奢々 2021-02-09 06:32

I am writing an iPad app in which I am rendering XML objects that represent shapes into graphics on the screen. One of the objects I am trying to render is arcs. Essentially the

3条回答
  •  自闭症患者
    2021-02-09 06:55

    You will have to use addQuadCurveToPoint:controlPoint:instead of bezierPathWithOvalInRect.

    The method definition is as:-

    - (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint
    

    that is CGPoint are the arguments(input) for both the parameters.

    You will also have to set the start point using moveToPoint:before calling addQuadCurveToPoint which will act as current point(As you can see their's no start point as parameter in the method).

    In your case you will have

    1>x,y as your starting point

    2>x+width and y+height as endpoint

    you don't need angles here or you can implement your logic to use the angles.Am uploading an image to make thing clear.

    Here is the image describing the start point,end point and control point

提交回复
热议问题