Avi
Avi

Reputation: 45

How can I start animating an UILabel from a particular location in iPad?

I need to start animating a UILabel when a button is pressed... the animation should start from the position of the button. How can I achieve this?

i.e moving label from one end of the screen to another end.

Upvotes: 0

Views: 1214

Answers (1)

Alex
Alex

Reputation: 2513

This is acheviced with UIView's animateWithDuration methods, which can be found in the documentation here.

A very simple example which should be called when your button is pressed:

[UIView animateWithDuration:0.5 animations:^{
     // set new position of label which it will animate to
     myLabel.frame = CGRectMake(x,y,width,height);
}];

Upvotes: 6

Related Questions