问题
I'm creating an application which has options to select themes. Depending on the theme selected, I want to also change the splash screen. If I don't use "Default.png" and use a image view or similar to show a splash screen image, I end up showing a black view during loading.
How can I show dynamic splash screens depending on the theme selected. Is it possible?
回答1:
Check the below SO post
Dynamic (Default.png) splashscreen in 3.0 [iPhone SDK]
Here is the blog post
Dynamic splash screen for iPhone or iPad application
Dynamic Splash
回答2:
This code may help you to add splash screen by coding
in .h class
UIImageView *myImgView;
//---------methods to show and hide splash----------
-(void)ShowSplash;
-(void)hideSplash;
in .m class
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[self ShowSplash];
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
[self.window makeKeyAndVisible];
return YES;
}
-(void)ShowSplash
{
myImgView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
myImgView.backgroundColor=[UIColor colorWithRed:0 green:.3 blue:0.5 alpha:1];
myImgView.image=[UIImage imageNamed:@"splashscreen.png"];
[self.window addSubview:myImgView];
[self performSelector:@selector(hideSplash) withObject:nil afterDelay:1];
}
-(void)hideSplash
{
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:myImgView.superview cache:YES];
[myImgView removeFromSuperview];
[UIView commitAnimations];
[myImgView release];
myImgView=nil;
self.window.rootViewController = self.viewController;
}
来源:https://stackoverflow.com/questions/5788454/iphone-showing-dynamic-splash-screens