iOS 13 UISplitView Problems

后端 未结 8 1272
情话喂你
情话喂你 2021-01-02 14:00

On iOS 13 Beta 5, I currently have problems with my UISplitView on iPhones.

My app starts with the detailsview off my splitview not with my masterview (look at the p

8条回答
  •  梦谈多话
    2021-01-02 14:12

    Alxlives's answer helped me. By using the debugger, I notice that in the master view controller, viewDidLoad is not called. So the delegate is never set, thus the collapse method is never called.

    I fixed this by setting the delegate in awakeFromNib():

    override func awakeFromNib() {
        self.splitViewController?.delegate = self
    }
    

    Now the splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool is called, and if you return true, the master will be displayed.

提交回复
热议问题