Reputation: 6861
I make an application on iPhone and iPad. I have the UISplitViewController
and I use it on iPad. When I launch my application on iPhone 6 Plus (simulator) UISplitViewController
doesn't work. (It's good work on iPad 3 or iPad Air 2 and iPhone 5s). I make following into my code.
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
performSegueWithIdentifier("showDetailParse", sender: nil)
} else if (UIDevice.currentDevice().userInterfaceIdiom == .Phone) {
performSegueWithIdentifier("showParse", sender: nil)
}
}
My screen from iPad works well
My screen from iPhone 6 Plus (simulator)
UPDATE: I updated my code which defines on which device it works and it did work! Into the code I define the height of a current device and if bigger than 2000 pixels I use segue for iPad. But I don't like this solution. Are there any ideas?
My updated code is below.
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
var screen = UIScreen.mainScreen().currentMode?.size.height
if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad) || screen >= 2000 && UIDevice.currentDevice().orientation.isLandscape == true {
performSegueWithIdentifier("showDetailParse", sender: nil)
} else if (UIDevice.currentDevice().userInterfaceIdiom == .Phone) {
performSegueWithIdentifier("showParse", sender: nil)
}
}
Upvotes: 1
Views: 352
Reputation: 15669
From what I can see on the screen you've provided - you have embedded UITabBarController
in your MasterViewController. I have done this previously as well and the trick is to not forget where you're pushing - not in the UINavigationController
because that's not the Master, the Master is the UITabBarController
.
I did this:
self.tabBarController?.performSegueWithIdentifier("showDetail", sender: nil)
Which worked for me well for this Storyboard layout:
Upvotes: 2