Domanda

I am trying to create an arc path in xcode and this is my code.

CGPathAddArc(thePath,NULL,100,200,300,200,100,YES);

This code works but it creates a very weird arc. I was wondering what each number in this code represents. I am trying to create an arc in the form of a half circle. Any suggestions?

È stato utile?

Soluzione

According to Apple documentation (which is really easy to look up by going to http://developer.apple.com/ios ), the first parameter is the path ref you are building. A transform is next (you've passed NULL).

Then, for the numbers, which are all CGFloats:

  • x The x-coordinate of the center point of the arc.
  • y The y-coordinate of the center point of the arc.
  • r The radius of the arc.
  • startAngle The angle (in radians) that determines the starting point of the arc, measured from the x-axis in the current user space.
  • endAngle The angle (in radians) that determines the ending point of the arc, measured from the x-axis in the current user space.

and ending with a "clockwise" bool.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top