UISplitViewController在iPad横向上隐藏主视图

时间:2016-01-27 03:47:38

标签: ios ipad

我想在iPad上显示displayModeButtonItem。我有这段代码:

self.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem;
self.navigationItem.leftItemsSupplementBackButton = YES;

它在iPhone 6+上运行良好。 iphone 6+

但iPad风景并不是那么好。 ipad landscape

帮助!!!

1 个答案:

答案 0 :(得分:0)

创建自定义UISplitViewController,并实现委托

class PrimarySplitViewController: UISplitViewController,
                                  UISplitViewControllerDelegate {

    override func viewDidLoad() {
        self.delegate = self
    }

    func splitViewController( _ splitViewController: UISplitViewController, 
collapseSecondary secondaryViewController: UIViewController, 
onto primaryViewController: UIViewController) -> Bool {
        return true 
    }
}