Created
March 29, 2010 02:45
-
-
Save winder/347303 to your computer and use it in GitHub Desktop.
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)startSplash { | |
[[[[UIApplication sharedApplication] windows] objectAtIndex:0] addSubview:self]; | |
splashImage = [[UIImageView alloc] initWithImage:self.image]; | |
if (self.animationIn == SplashViewAnimationNone) | |
{ | |
[self addSubview:splashImage]; | |
} | |
else if (self.animationIn == SplashViewAnimationFade) | |
{ | |
// add the splash image | |
[self addSubview:splashImage]; | |
// set up a transition animation | |
CATransition *anim = [CATransition animation]; | |
[anim setDuration:self.animationDelay]; | |
[anim setType:kCATransitionPush]; | |
[anim setSubtype:kCATransitionFade]; | |
[anim setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; | |
[[self layer] addAnimation:anim forKey:@"fade in"]; | |
} | |
// Slide in | |
else | |
{ | |
// add the splash image | |
[self addSubview:splashImage]; | |
// set up a transition animation | |
CATransition *anim = [CATransition animation]; | |
[anim setDuration:self.animationDelay]; | |
[anim setType:kCATransitionPush]; | |
NSString *transitionType; | |
switch (self.animationIn) | |
{ | |
case (SplashViewAnimationSlideLeft): | |
transitionType = kCATransitionFromLeft; | |
break; | |
case (SplashViewAnimationSlideRight): | |
transitionType = kCATransitionFromRight; | |
break; | |
case (SplashViewAnimationSlideUp): | |
transitionType = kCATransitionFromTop; | |
break; | |
case (SplashViewAnimationSlideDown): | |
transitionType = kCATransitionFromBottom; | |
break; | |
} | |
[anim setSubtype:transitionType]; | |
[anim setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; | |
[[self layer] addAnimation:anim forKey:@"SwitchToView1"]; | |
} | |
// Dismiss after delay. | |
[self performSelector:@selector(dismissSplash) withObject:self afterDelay:self.delay]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment