我该怎么做才能在应用程序启动之前显示图像?
我正在使用 Objective-c 为 iPhone 开发一个应用程序,在我的应用程序启动之前,我希望出现一个启动画面。
谢谢!
I´m doing an app for iPhone in objective-c, and before my app launches I want a splash screen to appear.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为您正在寻找 应用程序启动图像。
I think you are looking for Application Launch Images.
您只需将任何想要的图像重命名为“Default.png”,然后将其添加到您的项目中即可。就这样。应用程序将在加载应用程序时显示该图像。
You just need to rename any image you want to "Default.png" and just add it in your project. That's all. Application will display that image while your app is loading.
正如 veredesmaralad 回答的那样,您可以使用应用程序启动图像,但它并不是真正用作启动屏幕。其目的是向用户提供应用程序正在启动的即时反馈,同时给应用程序一些时间进行初始化。该图像由操作系统显示,直到您的应用程序将其窗口显示在屏幕上。显示时间因设备而异。
如果我尝试做一些更复杂的事情,例如更长时间地显示启动屏幕或为启动屏幕设置动画,我会显示启动屏幕的视图,然后转到主应用程序。我可能只是让我的主
UIViewController
显示视图,然后让NSTimer
告诉控制器何时用下一个视图(例如主用户界面)替换该视图。对于更复杂的动画启动屏幕,我可能会使用专用的 UIViewController 来运行该动画。然后,当动画完成时,我会让启动屏幕的控制器加载下一个控制器。As veredesmaralad answered, you can use an application launch image, but it's not really intended for use as a splash screen. It's intended to give the user immediate feedback that the app is launching, yet give the app some time to initialize. This image is displayed by the OS until your app puts its window on screen. The display time will vary from device to device.
If I were trying to do something more involved such as displaying the splash screen for a longer time, or animating the splash screen, I would display a view for the splash screen, then move on to the main app. I might just have my main
UIViewController
show the view, and then have anNSTimer
tell the controller when to replace the view with the next view (e.g. the main user interface). For a more involved animated splash screen I might use a dedicatedUIViewController
to run that animation. Then when the animation completes I'd have the splash screen's controller load the next controller.首先,这称为“启动屏幕”,您可能想从类似维基百科的地方阅读有关它的内容< /a>.
这个问题的答案在很大程度上取决于您使用的编程语言。如果您能提供更好的解释,就能给出更好的答案。
First off, this is called a "splash screen" and you may want to read up about it from somewhere like Wikipedia.
The answer to this question will depend heavily on what programming language you're using. If you could provide better explanation, a better answer can be given.