Zap*_*hod 44 iphone xcode multitasking ipad ios
我正在开发一款通用的应用程序,可以在iPad上使用所有方向,只在iPhone 上使用肖像.该应用程序适用于iOS 9兼容iPad上的分屏多任务,但我有这样的警告:
All interface orientations must be supported unless the app requires full screen
Run Code Online (Sandbox Code Playgroud)
我的应用程序不需要全屏.它仅限于iPhone上的肖像......不应该没问题吗?有没有办法只在iPhone上声明需要全屏?
提前致谢
顺便说一下,我正在使用Xcode 7.3.1
sib*_*urb 38
解决方法是使用"设备特定密钥":https: //developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254 -SW9
因此,您的plist值看起来像:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiresFullScreen~ipad</key>
<false/>
Run Code Online (Sandbox Code Playgroud)
当我删除iPad的特定版本的UIRequiresFullScreen密钥时,我失去了完整的分屏功能 - 只有"滑过"可用,因为这不会影响我的应用程序使用整个设备屏幕.
"设备方向"复选框用于默认的plist值.他们不会影响iPad上应用程序的唯一方法是,如果plist中有更具体的价值,那么这个价值专门针对iPad.
当系统在您的应用的Info.plist文件中搜索密钥时,它会选择最特定于当前设备和平台的密钥.
事实上,它太容易了...这就是为什么我甚至没有尝试过:
设置Portrait为设备的方向不会影响iPad的方向.
这意味着设备方向部分应该重命名为iPhone Orientation,实际上,使用该配置,iPhone仅支持Portrait并且iPad支持所有这些配置.由于我们没有检查,仍然允许分屏Requires full screen.
PS:至少在Xcode 8.3.1上,我没有在Xcode 7.x上测试它