UISplitViewController displayModeButtonItem in iPAD

╄→尐↘猪︶ㄣ 提交于 2020-06-15 18:29:49

问题


I have trouble with the UISplitView on iPad.

I create normal application using UISplitView and in DetailViewController I add

override func viewDidLoad() {
    super.viewDidLoad()

    navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
    navigationItem.leftItemsSupplementBackButton = true
}

in iPhone it work fine

But in iPad it doesn't show button for stretching the detail view controller.

I know it can be done, because Apple has it in Note application.

How to accomplish this the right way?


回答1:


Set the SplitViewController's preferredDisplayMode to UISplitViewControllerDisplayModeAllVisible and it will appear.

But this will change it in portrait mode too on the iPad, and you probably don't want it there, so you'll have to check when rotating and change it accordingly.



来源:https://stackoverflow.com/questions/43627214/uisplitviewcontroller-displaymodebuttonitem-in-ipad

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