iPhone 中的启动画面

发布于 2024-09-07 13:46:07 字数 89 浏览 1 评论 0原文

我的应用程序中有一个启动屏幕。但只有当应用程序从 xcode 运行时才会出现启动屏幕,而直接从模拟器启动时则不会出现。

请帮我。

谢谢。

I have a splash screen in my application. But the splash screen appears only when application is run from xcode and does not appear when launched directly from the simulator.

Please help me.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

◇流星雨 2024-09-14 13:46:07

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

如果您在标准启动屏幕“defaultXXX.png”上实现了一个额外的启动屏幕,您能详细说明一下您是如何编码的吗?

Its difficult to advice without further information, but this sounds like your app is taking longer to load when run from XCode since the debugger will be attaching at bootup etc, whereas launching from the simulator itself will be a quicker boot - perhaps the splash screen isn't staying on screen long enough for you to see it?

If you have implemented an additional splash screen to the standard boot screens 'defaultXXX.png', could you elaborate on how you have coded it?

旧时模样 2024-09-14 13:46:07

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

Which SDK are you using? If you use 4, probably your issue is connected with multitasking. In simulator with iOS4 when you launch your app you actually restore your app not lauch, if app was previously opened. When you start your application from XCode it "copies" your app to the simulator and starts "new instance".

可爱咩 2024-09-14 13:46:07

在应用程序委托.h 类中

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.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;

   }

in app delegate.h class

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

in 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;

   }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文