Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad SplitViewController - using an iPhone storyboard ViewController

I have an iPhone app and now I am trying to create an iPad version of it. I have an iPhone storyboard and now an iPad storyboard. My iPhone has two UIViewControllers that have associated .m and .h files (Pane1ViewController and Pane2ViewController) that I built using storyboard, with storyboard IDs "pane1" and "pane2."

I have a SplitViewController in my iPad storyboard and I'd like to use "pane1" and "pane2" for the two views in the split view. How can I do this so that it inherits all the UI elements as well as uses the existing .m and .h files associated with those two view controllers?

like image 628
CodeGuy Avatar asked Apr 15 '26 08:04

CodeGuy


1 Answers

Use [[UIDevice currentDevice] userInterfaceIdiom to differentiate between iPad and iPhone

Then in your app delegate, create your split view controller with both view controllers: self.splitViewController.viewControllers = @[chapterNavigationController, pageNavigationController];

Then make sure to set the rootViewController to your splitViewController: self.window.rootViewController = self.splitViewController;

like image 108
jaggedcow Avatar answered Apr 16 '26 22:04

jaggedcow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!