简体   繁体   English

UISplitViewController的详细信息视图仅在iOS8上全屏显示

[英]The detail view of a UISplitViewController takes full screen only on iOS8

My UISplitViewController was functioning properly until I compiled the project with the new SDK (iOS 8.0). 在我使用新的SDK(iOS 8.0)编译项目之前,我的UISplitViewController正常运行。 At some point (when the (void)viewDidAppear:(BOOL)animated of the detail view controller is called) the detail view maximizes to the full screen, covering the master view. 在某个点上(当调用详细视图控制器的动画的(void)viewDidAppear:(BOOL)动画时),详细视图最大化到全屏,覆盖了主视图。

I managed to fix it by using the new displayMode property of the UISplitViewController: 我设法通过使用UISplitViewController的新displayMode属性来修复它:

[self.splitViewController setPreferredDisplayMode:UISplitViewControllerDisplayModeAllVisible];

However this property is supported only in iOS8 and now I cannot build for iOS7. 但是,此属性仅在iOS8中受支持,现在我无法为iOS7构建。 Is my only choice now is to download the old SDK? 我现在唯一的选择是下载旧的SDK?

It sounds like your app was running okay on iOS 7.1, so (happily) you only need to execute that code in versions of iOS that do support it. 听起来您的应用程序在iOS 7.1上运行正常,因此(很高兴)您只需要在支持该代码的iOS版本中执行该代码即可。 So what about: 那么呢:

if ([self.splitViewController respondsToSelector:@selector(setPreferredDisplayMode:)]) {
[self.splitViewController setPreferredDisplayMode:UISplitViewControllerDisplayModeAllVisible];

} }

Compile with the new SDKs, and be able to run in old and new iOS. 使用新的SDK进行编译,并能够在新旧iOS中运行。 You then just need to set your build Deployment Targets appropriately. 然后,您只需要适当地设置构建部署目标即可。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM