2

How to make a universal application

 3 years ago
source link: https://www.codesd.com/item/how-to-make-a-universal-application.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to make a universal application

advertisements

I have a iPhone app I want to convert to an universal app so it can run on iPad. I have tried to find information about how to do it, but I don't find anything that answers my question. I have upgraded the iphone target in xcode to ipad. Then I get a new MainWindow-iPad.xib.

But I have many viewcontrollers and I have made those with code, not xib's. Do I need to have a if-clause in the loadView method that loads different viewcontroller depending on if the user has a iPhone or iPad?


It kind of depends on how you've implemented your loadView methods and how you want your iPad version to differ from your iPhone app.

If you just want your app to use the full screen, you can mostly just check the size of the screen and size your views appropriately and use the autoresizing mask to deal with things when you change orientations.

There are a few gotcha's with this approach, though. For example, modal views can work differently (not taking up the whole screen) and, obviously, the keyboard is a different size.

If you want to use completely different views for your iPad app then, yes, you'll quite possibly have if statements that tell it to use completely different view controllers.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK