iosobjective-cxibnib

Make an application work on both iPhone and iPad


I would like to make it so that my iPhone app also works on iPad.

If I run it using the iPad simulator it does work, but the app doesn't show up on the iPad app store, and looks really weird.

Is it possible to create another .xib file for the iPad? I know how to add a new iPad .xib file, yet I don't know how to actually change the RootViewController.xib to RootViewController_iPad.xib if the device being used is an iPad.

I already have code for finding out if the device is an iPad, and I don't want to use auto-layout, because I would like to add different things to the view if they are using an iPad (such as using different images).

I would like to make it so that my iOS applications look good on both iPhone and iPad, and have a separate .xib files for each. Is it possible to change the default .xib file from RootViewController to RootViewController_iPad?


Solution

  • In order to make an application work in both iPhone & iPad then need to follow below steps.

    1. Before create an project please select universal in device section.
    2. In application: didFinishLaunchingWithOptions: put a condition to check the device.
    3. If the device is iPad then load the iPad screen and if the device is iPhone then load the iPhone screen.
    4. Make sure follow the MVC pattern, So that it is easy to populate the data in both the screens.