Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Created June 26, 2014 21:59
Show Gist options
  • Save simonewebdesign/019d2b4e03a4e2e88c4d to your computer and use it in GitHub Desktop.
Save simonewebdesign/019d2b4e03a4e2e88c4d to your computer and use it in GitHub Desktop.
Blink Animation
//
// 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
@simonewebdesign
Copy link
Author

Should use recursion here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment