tags:

views:

246

answers:

2

Hello all,

I want to rotate a UILabel in semicircle.

So what I am planning to do is use some timing function like CaMediaTimingFunction.

I want to use getControlPointAtIndex method of CaMediaTiming Function so that I can get a set of points to rotate the UILabel. The points which I will get will help me in forming the frame for UILabel.

Does anybody have good idea other than this.

I want to rotate the Label in a semicircle very smoothly.

A: 

If you're making a game, you might want to take a look at cocos2d - it has some simple rotation & timer actions that are pretty easy to use.

http://code.google.com/p/cocos2d-iphone/

John
No I am not making any game, its a simple Data application, where I want to give user the flexibility to arrange the data.
rkb
+1  A: 

If all you want to do is rotate the label in an animated fashion, you should just be able to set the transform property of the UILabel within an animation block, like the following:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:5.0f];

label.transform = CGAffineTransformMakeRotation(90.0f * M_PI / 180.0f);

[UIView commitAnimations];

This will rotate your label by 90 degrees over a duration of 5 seconds.

If you wish to control the clockwise / counterclockwise direction of the rotation, you can refer to this answer, which shows how to use lower-level Core Animation keyframe animations to do this.

Brad Larson
This rotates the label, I want to rotate the location of label in semicircle.
rkb
OK. Your question wasn't very clear. To move the label along a curve, you can follow the directions I provide here: http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path/1143095#1143095
Brad Larson