Created
June 26, 2014 21:59
-
-
Save simonewebdesign/019d2b4e03a4e2e88c4d to your computer and use it in GitHub Desktop.
Blink Animation
This file contains hidden or 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
| // | |
| // ViewController.m | |
| // Animation | |
| // | |
| #import "ViewController.h" | |
| @interface ViewController () | |
| @property (weak, nonatomic) IBOutlet UIImageView *image; | |
| @property (strong, nonatomic) IBOutlet UILabel *label; | |
| @property (strong, nonatomic) IBOutlet UILabel *label2; | |
| @end | |
| @implementation ViewController | |
| - (void)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| [self performSelector:@selector(animateView) withObject:nil afterDelay:2]; | |
| } | |
| - (void) animateView { | |
| [UIView animateWithDuration:1.0 | |
| animations:^{ | |
| self.label.alpha = 0; | |
| } | |
| completion:^(BOOL finished) { | |
| [self animateView2]; | |
| }]; | |
| } | |
| - (void) animateView2 { | |
| [UIView animateWithDuration:1.0 | |
| animations:^{ | |
| self.label2.alpha = 1.0; | |
| } | |
| completion:^(BOOL finished) { | |
| [self animateView3]; | |
| }]; | |
| } | |
| - (void)animateView3 { | |
| [UIView animateWithDuration:1.0 | |
| animations:^{ | |
| self.label2.alpha = 0.0; | |
| } | |
| completion:^(BOOL finished) { | |
| [self animateView4]; | |
| }]; | |
| } | |
| - (void)animateView4 { | |
| [UIView animateWithDuration:1.0 | |
| animations:^{ | |
| self.label.alpha = 1; | |
| } | |
| completion:^(BOOL finished) { | |
| [self animateView]; | |
| }]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should use recursion here