Reputation: 45
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
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