我正在创建一个可以选择主题的应用程序。根据所选主题,我还想更改启动画面。如果我不使用“Default.png”并使用图像视图或类似图像来显示启动画面图像,我最终会在加载过程中显示黑色视图。
如何根据所选主题显示动态闪屏。有可能吗?
答案 0 :(得分:4)
检查以下SO帖子
Dynamic (Default.png) splashscreen in 3.0 [iPhone SDK]
这是博客文章
答案 1 :(得分:1)
此代码可帮助您通过编码添加启动画面
in .h class
UIImageView *myImgView;
//---------methods to show and hide splash----------
-(void)ShowSplash;
-(void)hideSplash;
<。>在.m类
- (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;
}