I have a view with a point on its center.
I have an angle in degrees (or radian, that's not the problem). I have a circle which center is the center of the view, and the radius is R.I'd like to draw :
something (let's say an image) on the point that is placed on the circle, at an angle of R from the vertical position.
an arc from the vertical position abov开发者_开发百科e the center that intersect the circle, to that point
How may I do that ?
I think it you could calculate the image position with:
CGPoint center = self.view.center;
float x = radius * cos(angle);
float y = radius * sin(angle);
CGPoint newPoint = CGPointMake(center.x + x, center.y + y);
Let me know if it worked.
As for drawing an arc you would have two points, one is newPoint that is calculated above (on circle depending the angle) and point above the center intersecting the circle which is calculated easily:
CGPoint pointAboveCenter = CGPointMake(center.x, center.y + radius);
精彩评论