Getting iPhone Apps to Run on the iPad - Page 2

Rory Lewis


One of the central features of the iPad, not found on the iPhone, is the master-detail interface. It's been around for a while on Mac operating systems, and now it has blossomed in a new form. Master-detail is an interface layer that sits on top of a list or a table and acts as an intermediate stage in place of a 'Go back' or 'Go to' button. On the iPhone, either the master or the detail can be seen, one at a time, but never both at the same time. This dual-purpose layer can serve the user in the e-mail realm, for instance, with the master as inbox and the detail as individual letter, or in countless other contexts as a table of contents and selected data. As you can see in this image from Apple, the iPad presents the master-detail in either orientation.

User Interface on the iPad

Some applications will scale up from the iPhone without problems. However, these applications are likely to be in the minority, as the input capabilities and display space of the iPad completely change an application's fundamental character. To accommodate this, we need to bring some specialized user interface design needs into the picture in order to present your application on both platforms.

The new interface elements introduced with the iPad allow for highly stylized and powerful data flow and interaction within an application. The smart folks at Apple have done most of the work for you, providing incredibly rich and easy-to-use interface elements that let you focus on the functionality of your application.

Checking the Platform

That's all fine and good, but obviously there are some things that the iPad can do that the iPhone cannot - and vice versa. We already know there are additional classes the iPad uses that the iPhone will not recognize. So what must we do to make our application behave correctly depending on which device it is currently running? This is, unfortunately, not as straightforward as one would hope, but it can be done.

For this reason, we are not going to worry about checking the current platform. Instead, we will just change the nib files to do what we need them to do on the iPad. Don't worry - nibs and Interface Builder work exactly the same way for the iPad as for iPhone.

However, if you absolutely must know, there are a variety of techniques used to check the current platform of an application. These all involve checking for the existence of platform specific classes, functions, or features. For example, you could check the width of the screen to determine the platform. An iPhone app will return a screen width of 320 pixels, while an app written for the iPad will return a screen width of 768 pixels. Clearly, if the returned screen width is less than 768, we know we are working on an iPhone or, perhaps, an iPod Touch. Of course, there are other ways of checking the current platform. You can also check a function called UI_INTERFACE_IDIOM().This function can return either UIInterfaceIdiomPhone or UIInterfaceIdiomPad. These examples are pretty self-explanatory, I hope, and can be used to accurately determine the device. Of the many different techniques to determine the current platform, you will learn to use the one that is the most convenient in the given context.


The release of iPhone OS 3.2 has changed a lot of basic functionality we are all used to on our iPhones and iPod Touches. However, not everyone will be using 3.2, so we need to make sure our applications are compatible with previous versions, specifically 3.1.2 and 3.1.3. Fortunately, doing so is quite simple. In your new iPhone OS 3.2 project, you need only set the 'Base SDK' in your project settings to 3.1.2 or 3.1.3 and run your application.

If you want to run your application in the iPad Simulator to see what it looks like, click on the pop-up button in the upper left corner of Xcode. From there, choose iPhone Simulator 3.2 (or higher). This will automatically move your application into the iPad Simulator. While your application is running in the iPad Simulator, you can zoom in on the action by pressing the 2x button in the lower right-hand corner of the Simulator. Additionally, you can zoom even further by opening the Window menu, hovering your mouse over the Scale item, and then choosing your desired zoom scale.

Add Comment      Leave a comment on this blog post
Aug 1, 2011 12:08 PM comment perdre du ventre comment perdre du ventre  says:
Very interesting points you have mentioned, thank you for putting up. Reply
Oct 21, 2011 8:10 AM recuperer son ex recuperer son ex  says:
Perfect piece of work you have done, this website is really cool with fantastic information. Reply
Dec 6, 2011 7:12 PM Anonymous Anonymous  says:
The new iOS5 Version of Dr. Lewis' is essentially the second edition of the book quoted above. This new book however focuses on storyboarding and iOS5. It will be on sale in February in bookstores but one can buy the eBook sooner. Check in here: Reply

Post a comment





(Maximum characters: 1200). You have 1200 characters left.



Subscribe to our Newsletters

Sign up now and get the best business technology insights direct to your inbox.