Created
March 28, 2012 04:03
-
-
Save koomar/2223511 to your computer and use it in GitHub Desktop.
iOS Animations
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
- (void)loadView { | |
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; | |
splashView.image = [UIImage imageNamed:@"Default.png"]; | |
[[[UIApplication sharedApplication] keyWindow] addSubview:splashView]; | |
[[[UIApplication sharedApplication] keyWindow] bringSubviewToFront:splashView]; | |
if (splashView) { | |
splashView.alpha = 1.0f; | |
[UIView beginAnimations:@"FadeOut" context:nil]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; | |
[UIView setAnimationDuration:0.5f]; | |
splashView.alpha = 0.0; | |
splashView.frame = CGRectMake(-60, -60, 440, 600); | |
[UIView commitAnimations]; | |
} | |
} | |
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { | |
if ([animationID isEqual:@"FadeOut"]) { | |
[splashView removeFromSuperview]; | |
[splashView release]; | |
splashView = nil; | |
} | |
} |
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
- (void)loadView { | |
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; | |
splashView.image = [UIImage imageNamed:@"Default.png"]; | |
[[[UIApplication sharedApplication] keyWindow] addSubview:splashView]; | |
[[[UIApplication sharedApplication] keyWindow] bringSubviewToFront:splashView]; | |
[UIView animateWithDuration:0.5f | |
animations:^{ | |
splashView.alpha = 0.0; | |
splashView.frame = CGRectMake(-60, -60, 440, 600); | |
} | |
completion:^(BOOL completion) { | |
[splashView removeFromSuperview]; | |
[splashView release]; | |
splashView = nil; | |
} | |
]; | |
} |
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
- (void) showCustomActivityView { | |
if (activityView && [activityView isAnimating] == YES) { | |
[activityView stopAnimating]; | |
[activityView removeFromSuperview]; | |
[activityView release]; | |
activityView = nil; | |
return; | |
} | |
UIImage *statusImage = [UIImage imageNamed:@"A-status1.png"]; | |
UIImageView *activityView = [[UIImageView alloc] initWithImage:statusImage]; | |
activityView.frame = CGRectMake(self.view.size.width/2 - statusImage.size.width/2, | |
self.view.size.height/2 - statusImage.size.height/2, | |
statusImage.size.width, | |
statusImage.size.height); | |
activityView.animationImages = [NSArray arrayWithObjects: | |
TTIMAGE(@"bundle://A-status2.png"), | |
TTIMAGE(@"bundle://A-status3.png"), | |
TTIMAGE(@"bundle://A-status4.png"), | |
TTIMAGE(@"bundle://A-status5.png"), | |
TTIMAGE(@"bundle://A-status6.png"), | |
TTIMAGE(@"bundle://A-status5.png"), | |
TTIMAGE(@"bundle://A-status4.png"), | |
TTIMAGE(@"bundle://A-status3.png"), | |
nil]; | |
activityView.animationDuration = 0.9; | |
[activityView startAnimating]; | |
[self.view addSubview:activityView]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment