UISplitViewController - 设置始终可见的主控制器 [英] UISplitViewController - set always visible master controller when

查看:711
本文介绍了UISplitViewController - 设置始终可见的主控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我研究过拆分视图的例子(喜欢这个 )它很棒。我只需要改变一下行为。当用户拥有iPad纵向时,我希望主屏幕和细节控制器都可见。它应该像FB Messenger或Skype一样工作。两个控制器并排,无法隐藏主控制器。怎么可能这样做?感谢您的帮助

I've studied examples of split view (like this one) and it works great. I just need one change of behavior. I would like to have both master and detail controller visible when user have iPad in portrait. It should work just like FB Messenger or Skype. Both controllers side-by-side and without able to hide master controller. How is it possible to do that? Thanks for help

奖金问题:是否有可能以某种方式设置iPad肖像的行为与iPhone肖像相同?如果我改变主意,我希望全屏显示细节,点击左侧导航栏按钮后,我会在全屏显示主视图,而不会显示细节。我是可能的还是拆分视图决定了我可以做些什么呢?

Bonus question: Is it possible to somehow set behavior for iPad portrait be same like iPhone portrait? If I would change my mind and I would like to have detail in fullscreen and after tap on left navigation bar button I would have master view in fullscreen and without detail visible. Is i possible or split view decides that and there is not much what I can do about it?

推荐答案

UISplitViewController有一个属性名为 preferredDisplayMode 。您可以将其设置为以下任何一个值:

A UISplitViewController has a property called preferredDisplayMode. You can set this to any one of these values:


  1. UISplitViewControllerDisplayModeAutomatic

  2. UISplitViewControllerDisplayModePrimaryHidden

  3. UISplitViewControllerDisplayModePrimaryOverlay

  4. UISplitViewControllerDisplayModeAllVisible

  1. UISplitViewControllerDisplayModeAutomatic
  2. UISplitViewControllerDisplayModePrimaryHidden
  3. UISplitViewControllerDisplayModePrimaryOverlay
  4. UISplitViewControllerDisplayModeAllVisible

您正在寻找 UISplitViewControllerDisplayModeAllVisible

[self.splitViewController setPreferredDisplayMode:UISplitViewControllerDisplayModeAllVisible];




UISplitViewControllerDisplayModeAllVisible

UISplitViewControllerDisplayModeAllVisible

主视图控制器和辅助视图控制器在屏幕上并排显示。

The primary and secondary view controllers are displayed side-by-side onscreen.

在iOS 8.0及更高版本中可用。

Available in iOS 8.0 and later.

您可以阅读有关显示模式的更多信息此处

You can read more about the display modes here on Apple's documentation.

这篇关于UISplitViewController - 设置始终可见的主控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆