Xcode 6 Adaptive Storyboard different Segues per Device

1k views Asked by At

I've some troubles with the newly introduced adaptive storyboard in Xcode 6. The iPhone App is finished and now I want to create a universal app out of it. Let's assume I've a viewcontroller that displayes some cells and a detail viewcontroller in which the details of the cells are displayed.

On iPhone: When I click the cell I've a push segue to the detail view. On iPad: I would like to have a modal segue instead of a push.

Can I change this in the prepareForSegue or somehow else?

EDIT: I found a way... but I'm not fully happy with it. If someone has a better solution, please tell me...

I made two segues and distinguish it in the code.

    if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
        self.performSegueWithIdentifier(kSegueToDetailModal, sender: object)
    }
    else if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
        self.performSegueWithIdentifier(kSegueToDetail, sender: object)
    }
1

There are 1 answers

0
SeanR On BEST ANSWER

You can have two segues and distinguish in code as you suggest, but I recommend using adaptive size classes to determine which segue you want rather than the userInterfaceIdiom. This way you could also use the modal segue with, for example, the iPhone 6 Plus in landscape orientation as well as iPad.