Skip to content

Instantly share code, notes, and snippets.

@okaram
Last active December 10, 2015 07:58
Show Gist options
  • Save okaram/4404906 to your computer and use it in GitHub Desktop.
Save okaram/4404906 to your computer and use it in GitHub Desktop.
IOS animation example
-(IBAction)cellAnimation:(id)sender
{
self.imgView.animationImages=self.images;
self.imgView.animationDuration=3;
self.imgView.animationRepeatCount=2;
[self.imgView startAnimating];
}
-(IBAction)propertyAnimation:(id)sender
{
CGRect frame1=self.imgView.frame;
if(frame1.origin.x==0)
frame1.origin.x=200;
else
frame1.origin.x=0;
[UIView animateWithDuration:3 animations:^{self.imgView.frame=frame1;}];
}
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property IBOutlet UIImageView* imgView;
@property NSArray* images;
-(IBAction)propertyAnimation:(id)sender;
-(IBAction)cellAnimation:(id)sender;
@end
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.images=[NSArray arrayWithObjects:[UIImage imageNamed:@"boy0.png"], [UIImage imageNamed:@"boy1.png"],
[UIImage imageNamed:@"boy2.png"],[UIImage imageNamed:@"boy3.png"],
[UIImage imageNamed:@"boy4.png"],[UIImage imageNamed:@"boy5.png"],
[UIImage imageNamed:@"boy6.png"],[UIImage imageNamed:@"boy7.png"],
[UIImage imageNamed:@"boy8.png"],[UIImage imageNamed:@"boy9.png"],
nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment