iPad:根据方向在 applicationDidFinishLaunching 期间添加全屏图像
我想在启动iPad应用程序时制作一个“闪屏”:启动时显示默认-[风景|肖像]~ipad.png,之后我想自己添加相同的图像并让它消失出去。
问题是 applicationDidFinishLaunching 期间的方向;我在确定正确图像并将其添加到 UIWindow (似乎是纵向)时遇到问题。
如何在启动期间添加全屏图像然后让它淡出?
非常感谢!
I'd like to make a "splash screen" while starting the iPad app: the Default-[Landscape|Portrait]~ipad.png is shown while starting, afterwards I'd like to add the same image by myself and let it fade out.
The problem is the orientation during applicationDidFinishLaunching; I've got problems to determine to correct image and add it to UIWindow (which seems to be in portrait).
How's it possible to add a fullscreen-image during launch and then let it fade out?
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将
flashView
添加到viewDidLoad
中的RootViewController.view
中:并在
applicationDidFinishLaunching
之后将 alpha 属性设置为 0.0 <代码>RootViewController的viewDidAppear
:You can add
flashView
to yourRootViewController.view
inviewDidLoad
:And after
applicationDidFinishLaunching
animate alpha property to 0.0 inRootViewController
'sviewDidAppear
:您在
application:didFinishLaunchingWithOptions:
期间出现的方向问题属于预期行为;请参阅获取 iPad 应用的启动方向,了解上一个问题正是这个话题。最好的解决方案是让根视图控制器处理显示启动屏幕,或者使用带有
UIModalTransitionStyleCrossDissolve
的模态视图控制器来显示启动屏幕。这样你就可以对正常的 查看旋转事件并根据需要更改启动屏幕图像。或者您可以阅读 UIDevice 的
orientation
属性,但这当然有可能不会被更新(即使您从application:didFinishLaunchingWithOptions:
调用beginGenerateDeviceOrientationNotifications
),直到为时已晚。Your problem with orientation during
application:didFinishLaunchingWithOptions:
is expected behavior; see Get launch orientation of iPad app for a previous question on exactly this topic.The best solution is to have your root view controller handle displaying the splash screen, or present the splash screen using a modal view controller with
UIModalTransitionStyleCrossDissolve
. That way you can react to the normal view rotation events and change the splash screen image as needed.Or you may be able to read UIDevice's
orientation
property, but it is certainly possible that this too won't be updated (even if you callbeginGeneratingDeviceOrientationNotifications
fromapplication:didFinishLaunchingWithOptions:
) until too late.