0

I have a UINavigationController which loads a table view. Cells push detail view controllers onto the screen. Now my app is becoming universal and I feel stuck with how to go about using a UISplitViewController on iPad.

What is the Apple-recommended way to implement a UISplitViewController for a iPhone UINavigationController on iPad? How does the code know it should load the UISplitViewController on iPad but ignore it on iPhone?

This is what I found in a guide:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
     // The device is an iPad running iOS 3.2 or later.
}
else {
     // The device is an iPhone or iPod touch.
}

But, is it really the way to conditionally load iPad UI vs. iPhone UI? I don't use IB or Nibs.

iamjustaprogrammer
  • 1,634
  • 2
  • 17
  • 34
  • This link maybe helpful. [here](http://stackoverflow.com/questions/24184003/adaptive-segue-in-storyboard-xcode-6-is-push-depricated) – Ezimet Aug 16 '14 at 14:59

1 Answers1

0

Since iOS8, you are very recommended to use a split view controller in both cases. The system will worry for you how to behave on compact devices (so it will push the detail view controller instead of displaying it in the split view controller).

This functionality is only for iOS8. If you need to support older operating systems, you need to split your views into multiple storyboards or XIB files, and in runtime query the user interface idiom and decide which to load, and how to perform specific tasks.

Léo Natan
  • 56,823
  • 9
  • 150
  • 195
  • Actually, you can implement a UISplitViewController in a Storyboard and it will be backwards compatible with iOS 7, iPad and iPhone. Xcode automatically generates an appropriate implementation for the device and OS. It is currently buggy though (beta 5). – Jordan H Aug 16 '14 at 19:51
  • I don't see how that would work. You'd still have to make many changes. Probably why it is so buggy. Why is Apple bothering with this? – Léo Natan Aug 16 '14 at 19:57
  • If all you have is a simple split view it should work great, but if you need to customize its behavior it'll no doubt be trickier to support both OSes and all devices. I'm using it extensively in my app though and it's working great minus a few major issues I expect Apple will resolve in the near future. – Jordan H Aug 16 '14 at 20:03