Xcode 4 支持的设备方向
我最近升级到 Xcode 4。以前在 Xcode 3 中,要设置允许的设备方向,您必须在应用程序委托中编辑 shouldAutorotateToInterfaceOrientation:
方法。但现在在 Xcode 4 中我看到 Targets -> 中有一个选项摘要,您可以在其中选择不同的方向。
哪一种选择将取代另一种选择?
干杯,
彼得
I recently upgraded to Xcode 4. Previously in Xcode 3 to set the allowed device orientations you had to edit the shouldAutorotateToInterfaceOrientation:
method in the application delegate. But now in Xcode 4 I see there is an option in Targets -> Summary where you can select different orientations.
Which alternative will rule over the other?
Cheers,
Peter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的记忆力有点问题;
shouldAutorotateToInterfaceOrientation:
位于 UIViewController 的自定义子类中。因此它允许每个视图控制器单独说明它工作的方向。因此,您可以拥有一个主要在纵向或横向模式下工作的应用程序,但有一个仅在纵向模式下工作的视图控制器,例如,如果您要合并现成的代码,这会很有用。目标中支持的设备方向 ->摘要进入您的 Info.plist,向操作系统提供元数据,而无需启动您的应用程序。
理想情况下,两者应该达成一致,而且我认为任何一个都不会凌驾于另一个之上。摘要信息应该总结您所有的各种视图控制器,但如果您填写不正确,除了奇怪的启动行为之外,我会感到惊讶。
Your memory is slightly faulty;
shouldAutorotateToInterfaceOrientation:
is in custom subclasses of UIViewController. So it allows each view controller to say which orientations it works in individually. So you can have an app that overwhelmingly works in portrait or landscape, but has a view view controllers that only work in portrait, for example — which is useful if you're incorporating off-the-shelf code.The supported device orientations in targets -> summary go into your Info.plist, to provide metadata to the OS without it having to launch your app.
Ideally the two should agree, and I don't think either one overrides the other. The summary information should summarise all of your various view controllers, but I'd be surprised if you got anything other than the odd weird launch behaviour if you fill it in incorrectly.
“目标摘要”只是 Info.plist 文件中数据的简写,因此之前已经可用。这里没什么新鲜事。
The "target summary" is just short hand for the data in the Info.plist file and so this has been available before. Nothing new here.