为什么在iPhone 6 Plus上未调用splitViewController:collapseSecondaryViewController:ontoPrimaryViewController :? [英] Why splitViewController:collapseSecondaryViewController:ontoPrimaryViewController: is not called on iPhone 6 Plus?

查看:128
本文介绍了为什么在iPhone 6 Plus上未调用splitViewController:collapseSecondaryViewController:ontoPrimaryViewController :?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中为iPhoneiPad都实现了UISplitViewController的子类.当我将设备从Landscape旋转到Portrait方向时,将调用标题中提到的方法.除非我在iPhone 6 Plus上运行该应用程序,否则它确实非常不错.为什么不在那里调用此方法?

I implemented subclass of UISplitViewController in my app for both: iPhone and iPad. Method mentioned in title is called when I rotate device from Landscape to Portrait orientation. It works really nice unless I run the app on iPhone 6 Plus. Why this method is not called there?

如何使此方法起作用?

当我在iPhone 6 Plus上启动应用程序时,两个方向的一切都很好.但是问题是当我将iPhone 6 PlusLandscape旋转到Portrait时.我的导航控制器无法正常工作.

When I start the app on iPhone 6 Plus everything is fine in both orientations. But the problem is when I rotate iPhone 6 Plus from Landscape to Portrait. My navigation controller is not gonna work as it is expected.

这是我的意思:

iPhone 5s纵向

当我选择位置时,iPhone 5s Portrait

具有选定位置的iPhone 5s横向

当我从横向旋转到纵向时,iPhone 5s

iPhone 6 Plus Portrait

当我选择位置时,iPhone 6 Plus Portrait

具有选定位置的iPhone 6 Plus Landscape

iPhone 6 Plus,当我从横向"旋转到纵向"时 this is a problem,因为未调用我的方法splitViewController:collapseSecondaryViewController:ontoPrimaryViewController:.当时的UINavigationController无法正常工作.当我选择位置时,什么也没发生.

iPhone 6 Plus when I rotate from Landscape to Portrait this is a problem because my method splitViewController:collapseSecondaryViewController:ontoPrimaryViewController: is not called. UINavigationController at that time is not working. When I select location nothing happens.

class PBOSplitViewController: UISplitViewController, UISplitViewControllerDelegate {
    override func viewDidLoad() {
        super.viewDidLoad()

        preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible
        delegate = self
    }

    func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController: UIViewController!, ontoPrimaryViewController primaryViewController: UIViewController!) -> Bool {
        return false
    }
}

我在Storyboard中设置了SplitViewController.

I setup my SplitViewController in Storyboard.

推荐答案

iPhone 6+的屏幕更大,并且在某些方面被视为iPad. iPhone 6+上的拆分视图控制器将尝试显示与iPad相似的主窗格和详细窗格,除非该应用程序处于缩放显示模式".

iPhone 6+ has a larger screen and in some ways is treated like an iPad. A split view controller on an iPhone 6+ will try to display both master and detail panes similarly as on an iPad, unless the application is in "Zoomed Display Mode".

NSHipster上有一篇文章对此进行了更详细的解释: http://nshipster.com/uisplitviewcontroller/

NSHipster has an article explaining this in greater detail: http://nshipster.com/uisplitviewcontroller/

这篇关于为什么在iPhone 6 Plus上未调用splitViewController:collapseSecondaryViewController:ontoPrimaryViewController :?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆