Basic Animation iPhone

When i was trying to learn how to do basic animation for moving layers i found that not many boks or online resources could effectively communicate what needed to be done. Finally i found out how to do it an easy way. This does not need any other frameworks added in. This example animates the movement of a button to the point (200,200) over 0.3 seconds.
The Setup:
You have a button in your view called myButton.
The Code:
//Set up animation duration and delegate
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[UIView setAnimationDelegate:self];
//This allows you to set a method that will be called when the animation finishes
[UIView setAnimationDidStopSelector:@selector(growAnimationDidStop:finished:context:)];
//This sets the new center for the button = CGPointMake(200,200);
//This starts the animations
[UIView commitAnimations];

No Responses Yet to “Basic Animation iPhone”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: