Reputation: 125
Here is how I made a universal app from an existing iPhone project by creating ~ipad.xib(s) using duplicate and then adding them back to a backup of the project, and checking universal.
I used xcode 4.02 with a base sdk of 4.3.3 with a deployment target of 3.1.2.
I couldn't find any documentation on whether it is OK to do it this way. It works on these physical devices so far:
iPad 2 with 4.3, iPod touch v1 with 3.1.2, iPod touch v4 (retina) with 4.1
Is this a correct way of creating a universal app? It seems easy enough now that I have this worked out, but took forever to find this info. Oh also I do not have a mainwindow.xib but other nibs that get loaded elsewhere as tableview section headers and detail views in a tabbar app - so I left the main interface sections blank.
Oh - I don't have an iPad 1 and cant test on that device, but it doesn't seem to work right in the iPad 3.2 Simulator, but all other devices and simulators appear to work OK.
Upvotes: 1
Views: 1869
Reputation: 50717
What I have seen a lot of people do is use 2 separate classes for each device. Why? Couldn't tell you!
What I do is use 1 class for both iPad and iPhone, only I use a macro to determine what the current device is:
#define IDIOM UI_USER_INTERFACE_IDIOM()
#define IPAD UIUserInterfaceIdiomPad
if (IDIOM == IPAD)
{
/* do something specific for iPad. */
} else {
/* do something specific for iPhone, like set up frames. */
}
Of course, you will need to create iPad versions of your Interfaces, but that is the easy part.
As far as identifying it as a Universal app, there is an option in your Project settings, as well as Target Device Family in build settings that you will make sure is set to iPhone/iPad.
That is pretty much all I do to make universal apps, and is quite less time consuming as writing specific classes for each device!
Upvotes: 2