当您知道自己在做什么时,启动画面动画真的很酷。不幸的是,除了 iPod(我怀疑还有日历和消息)应用程序之外,无法更改应用程序的启动画面。所以……作弊。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//inits and windows and such
// Make this interesting.
_splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
//make Default.png some boring white or grey color
_splashView.image = [UIImage imageNamed:@"Default.png"];
coloredSplashView_ = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
coloredSplashView_.image = [UIImage imageNamed:@"colored_splash.png"];
[coloredSplashView_ setAlpha:0.0f];
[_window addSubview:_splashView];
[_window addSubview:coloredSplashView_];
[_window bringSubviewToFront:coloredSplashView_];
[UIView animateWithDuration:1.00 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
coloredSplashView_.alpha = 1.0;
//make the splash visible
}completion:^(BOOL finished) {
//my personal touch: make it expand and fade out
[_splashView removeFromSuperview];
[UIView animateWithDuration:1.00 animations:^{
[coloredSplashView_ setTransform:CGAffineTransformMakeScale(1.2, 1.2)];
[coloredSplashView_ setAlpha:0.0f];
}completion:^(BOOL finished){
[coloredSplashView_ removeFromSuperview];
}];
}];
return YES;
}