UISplitViewController - set always visible master controller when

℡╲_俬逩灬. 提交于 2019-12-10 22:28:46

问题


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

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?


回答1:


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

You are looking for UISplitViewControllerDisplayModeAllVisible.

[self.splitViewController setPreferredDisplayMode:UISplitViewControllerDisplayModeAllVisible];

UISplitViewControllerDisplayModeAllVisible

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

Available in iOS 8.0 and later.

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



来源:https://stackoverflow.com/questions/33167006/uisplitviewcontroller-set-always-visible-master-controller-when

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!