4

Consider this image (size is 10x140; arrow is 10x70):

Circle from 0 to 160° degrees

The Red arrow is my problem, because I want it to rotate.

Now I'm using

CGFloat Angle = [Speed.text intValue] / 160.0;
_Arr.layer.transform = CATransform3DMakeRotation(Angle * M_PI * 2, 0, 0, 1);

When _Arr rotates, it loses the center. As you see in the picture, the center is the plus ("+") sign, and the arrows in opaque are the problems.

I tried also to set center and anchor point, but I get the same results. I made the arrow image double (double heigth, image half), same thing.

This is the interface builder:

Interface builder

What's could be the problem?

Is the CATransform3DMakeRotation the problem or the image? The anchor point? the degree formula? Both?

4

1 に答える 1

1

アンカーポイントが答えです(「矢印の中心点を画像の端点の1つに移動します」)。このチュートリアルを確認してくださいhttp://www.mobisoftinfotech.com/blog/iphone/ios-tutorial-custom-speedometer-control/

于 2012-12-19T12:47:27.770 に答える