iOS 13 UISplitView Problems

后端 未结 8 1207
情话喂你
情话喂你 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:33

    I had the same issue.

    After a bit of investigation it seems like viewDidLoad is too late to set it to all visible.

    I subclassed the UISplitViewController and changed the setting in awakeFromNib method. Now it is working as expected.

    0 讨论(0)
  • 2021-01-02 14:35

    Warren Milward's answer helped me to guide me in the right direction, but actually I got it working with viewDidLoad().

    I ended up using a subclass for the UISplitViewController and set the required values in viewDidLoad() as well as the delegate calls here.

    class CustomSplitViewController: UISplitViewController, UISplitViewControllerDelegate {
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            self.delegate = self
            self.preferredDisplayMode = .allVisible
        }
    
        func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool {
            return true
        }
    }
    
    0 讨论(0)
提交回复
热议问题