Converting an iPhone app to a Universal app?

后端 未结 3 947
孤街浪徒
孤街浪徒 2021-01-14 09:56

I have an iPhone app with FirstViewController and SecondViewController with respective views FirstV

相关标签:
3条回答
  • 2021-01-14 10:05

    There Are following Rules To Convert The Iphone App to Univarsal App

    1) In Plist File Add NSMainNibFile~ipad .... MainWindow_ipad(ipad window).

    2) Implement separate Names Xibs (Iphone & ipad)

    3)in Target Targeted Device Family set to (iphone/ipad) and set The Frames According To Ipad &iphone For example

    if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) {

    btnHme.frame=CGRectMake(971,6, 32, 32); //ipad

    } else {

    btnHme.frame=CGRectMake(438,6, 32, 32); //iphone

    }

    cheers

    0 讨论(0)
  • 2021-01-14 10:11

    if you are using Xcode4 you can use "transition to universal target" and it will do everything needed

    http://xcodebook.com/2011/05/making-an-ios-target-universal/

    if you dont have it then I recommend to keep controllers out of your xib. xib files will be only containing views for iphone and ipad but the controllers "can" be same. and you can control your logic from the rootviewcontroller, just an idea..it all depends on your project.

    0 讨论(0)
  • 2021-01-14 10:13

    You would be best of to just create a new ViewController unless you're into masochism. Reusing in that way would most likely be to much trouble, and I'd go with aggregation or inheritance in the case you need to reuse logic in your ViewControllers.

    I typically create a base ViewController, say XYZViewController and then create a XYZViewController_iPhone with all iPhone-specials and a separate XYZViewController_iPad for iPads. But if they're totally different I give them unique names and their own NIBs as well as ViewControllers.

    0 讨论(0)
提交回复
热议问题