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.
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.