Last active
December 10, 2015 07:58
-
-
Save okaram/4404906 to your computer and use it in GitHub Desktop.
IOS animation example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(IBAction)cellAnimation:(id)sender | |
{ | |
self.imgView.animationImages=self.images; | |
self.imgView.animationDuration=3; | |
self.imgView.animationRepeatCount=2; | |
[self.imgView startAnimating]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(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;}]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface ViewController : UIViewController | |
@property IBOutlet UIImageView* imgView; | |
@property NSArray* images; | |
-(IBAction)propertyAnimation:(id)sender; | |
-(IBAction)cellAnimation:(id)sender; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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