I have this sample image

enter image description here

i need to block the center in the middle of the circle when i rotate.
What's the anchor point? It's the anchor point the problem?

Now the image rotate, unconsidering the anchor point.

_Image.layer.anchorPoint = CGPointMake(0.5, 0.5); //?
[...]
CGFloat wAngle = Degrees2Radians([_Weight.text intValue]/300.0*360);
_Image.layer.transform = CATransform3DMakeRotation (wAngle+M_PI, 0, 0, 1);

I need to make a test, like an inverse clockwise starting from 0 to 300, retaining the center.

0, arrow to bottom
150, arrow to top
300, arrow to bottom
etc...

thanks.

有帮助吗?

解决方案

This is by default

_Image.layer.anchorPoint = CGPointMake(0.5, 0.5); //

Use something like CGPointMake(0.5, 0.25)

U will need to calculate where u want to set. These are not exact values

其他提示

Try this one.It may help you.

CGAffineTransformMakeRotation(-M_PI * 0.5);

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top