Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why splitViewController:collapseSecondaryViewController:ontoPrimaryViewController: is not called on 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?

What to do to make this method work?

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.

This is what I mean:

iPhone 5s Portrait
enter image description here

iPhone 5s Portrait when I select location

enter image description here

iPhone 5s Landscape with selected location

enter image description here

iPhone 5s when I rotate from Landscape to Portrait

enter image description here

iPhone 6 Plus Portrait

enter image description here

iPhone 6 Plus Portrait when I select location

enter image description here

iPhone 6 Plus Landscape with selected location

enter image description here

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.

enter image description here

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
    }
}

I setup my SplitViewController in Storyboard.

like image 674
Bartłomiej Semańczyk Avatar asked Apr 21 '15 09:04

Bartłomiej Semańczyk


1 Answers

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 has an article explaining this in greater detail: http://nshipster.com/uisplitviewcontroller/

like image 50
Nikola Lajic Avatar answered Nov 15 '22 12:11

Nikola Lajic