iphone中的启动画面

时间:2010-06-30 05:56:41

标签: iphone

我在我的应用程序中使用了启动画面。但只有在从xcode运行应用程序时才会出现启动画面,并且直接从模拟器启动时不会出现。

请帮帮我。

感谢。

3 个答案:

答案 0 :(得分:1)

如果没有进一步的信息,很难提供建议,但这听起来像你的应用程序从XCode运行时需要更长时间加载,因为调试器将在启动时附加等,而从模拟器本身启动将是一个更快的启动 - 也许是闪屏不会停留在屏幕上足够让你看到它?

如果您已为标准启动屏幕'defaultXXX.png'实施了额外的启动画面,您能否详细说明如何对其进行编码?

答案 1 :(得分:1)

您使用的是哪种SDK?如果您使用4,可能您的问题与多任务处理有关。在使用iOS4的模拟器中,当您启动应用程序时,如果以前打开了应用程序,您实际上还原了应用程序。当您从XCode启动应用程序时,它会将您的应用程序“复制”到模拟器并启动“新实例”。

答案 2 :(得分:1)

app appate.h中的

UIImageView *myImgView;
 //---------methods to show and hide splash----------
 -(void)ShowSplash;
 -(void)hideSplash;

在app delegate .m class

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
// Override point for customization after application launch.
   self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
[self ShowSplash];
[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;

   }
相关问题