-1

I know many questions related to this topic has already been asked and answered but none of them completely resolved the issue I'm facing. And there there are too many suggestions so I'm pretty confused what to use and what not to.

Anyway here's my scenario. I'm trying to create an iOS app using the Empty Application template in Xcode 4.6.2. Its a universal app so I added two storyboards, one for iPhone and one for iPad.

The problem is when I run it, it only displays a black white background with the warning message, application windows are expected to have a root view controller at the end of application launch.

I did add the Main storyboard from the Build Settings. It works fine say, if I set the iPhone storyboard there and run the iPhone simulator. But since I have two storyboards, I don't know what to do.

Please give me the right, clear instructions to sort this out.

Also which one of the following is the recommended way?

  1. Share a single ViewController for both iPhone and iPad storybaords.
  2. Create separate ViewControllers for each device?

Thanks a lot in advance.

Isuru
  • 30,617
  • 60
  • 187
  • 303

1 Answers1

1

For an universal app you can set different storyboards for iphone and ipad in the build settings under summary section. It will automatically take the corresponding storyboard according to the device.

iPhone/ iPod Deployment Info - Settings for iphone
iPad Deployment Info - Settings for iPad

enter image description here

Community
  • 1
  • 1
Anil Varghese
  • 42,757
  • 9
  • 93
  • 110
  • Thanks! It works alright for the iPhone now but the iPad is still showing the white background. btw I have modified the `AppDelegeate.m` file like explained [here](http://stackoverflow.com/a/8521493). – Isuru Jun 15 '13 at 08:01
  • add a navigation/tabbar controller to ipad storyboard – Anil Varghese Jun 15 '13 at 08:05
  • I've already added a `NavigationController` but the issue is still there. – Isuru Jun 15 '13 at 08:29
  • white background i didnt get.. any logs? add something to the ipad storyboard and check wether it is showing? – Anil Varghese Jun 15 '13 at 08:37
  • No logs, no warnings whatsoever. I put a label on the iPad storyboard scene but nothing. I've attached the sample program [here](http://www72.zippyshare.com/v/57317968/file.html). If you could take a look at it and tell me what I'm missing or doing wrong, I'd be grateful. Thanks :) – Isuru Jun 15 '13 at 08:46
  • i check your code.. i didnt find label in your storyboard. So i added its working.. both in ipad and iphone – Anil Varghese Jun 15 '13 at 08:58
  • Oh I removed the label because it wasn't showing. Really? That's weird. :/ – Isuru Jun 15 '13 at 09:21
  • Ya.. its working for me. Just i changed deployment target to 6.0(6.1 not available for me) then added buttons to storyboard – Anil Varghese Jun 15 '13 at 09:24
  • I ran it in another Macbook and it works fine. There must have been something wrong with the simulators in the other machine. Anyway, thanks a lot. :) btw do you have any suggestions on my 2nd question? About creating separate `ViewController` files or single `ViewController` file for both? – Isuru Jun 20 '13 at 04:05
  • Creating separate view controllers is upto u... what i will do is even though the ui is different and operations are almost same(both have lot of common operations) i will use same VC for both. So you can avoid the rewriting the same code, only some checking requires. If iPad have more features and requires complex calculations go for separate VC's so you can avoid much confusions, better debugging – Anil Varghese Jun 20 '13 at 04:29