//This are some classes for Animation on Objective-c used in the iPhone.
//.h class
IBOutlet UIView *mover;
IBOutlet UIView *grower;
IBOutlet UIView *flipper;
IBOutlet UIImageView *iv;
}
@property (nonatomic, retain) UIView *mover;
@property (nonatomic, retain) UIView *grower;
@property (nonatomic, retain) UIView *flipper;
@property (nonatomic, retain) UIImageView *iv;
-(IBAction) move;
-(IBAction) grow;
-(IBAction) flip;
@end
//.m class
//just change the name to your buttons
@synthesize mover, grower, flipper, iv;
- (IBAction) move {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationRepeatCount:10];
[UIView setAnimationRepeatAutoreverses:YES];
CGPoint pos = mover.center;
pos.y = 220.0f;
mover.center = pos;
[UIView commitAnimations];
}
- (IBAction) grow {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationRepeatCount:5];
[UIView setAnimationRepeatAutoreverses:YES];
CGRect b = grower.bounds;
b.size.height = 200;
b.size.width = 200;
grower.bounds = b;
[UIView commitAnimations];
}
- (IBAction) flip {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationRepeatCount:5];
[UIView setAnimationRepeatAutoreverses:YES];
flipper.backgroundColor = [UIColor blackColor];
[UIView commitAnimations];
}