Copy from Beginning iOS 4 Application Development,author:Wei-Meng Lee, Microsoft MVP ,come from Singapore.
- technique 1 — mODifying the Device tArget Setting
The Targeted Device Family setting provides three different values: iPhone, iPad, or iPhone/iPad.
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)
//---code within this block will be compiled if application is compiled
// for iPhone OS 3.2 and above---
#endif
- technique 2 — creAting univerSAl ApplicAtiOnS
Apple recommends that you create a Universal application, one that targets both the iPhone and the
iPad, with separate XIB files representing the UI for each platform.
in Xcode, select Targets Universal. Then select Project Upgrade Current Target for iPad .
In the dialog box that appears, check the One Universal application option and click OK
- technique 3 — mAintAining twO cODe BASeS
The third technique for developing your application for multiple devices is to maintain separate targets for your application.
Using this approach, you will have two executables eventually one for the iPhone/iPod touch, and one for the iPad.
The following steps explain how to accomplish this.
1 . Using Xcode, create a View-based Application (iPhone) project and name it MyAppiPhone.
2 . Select Targets MyAppiPhone, and then select Project Upgrade Current Target for iPad.
3 . In the dialog box that appears, select the Two device-specific applications option and click OK .
mAking yOur chOice
Now that you have seen the three techniques for porting your iPhone application to support the iPad, which technique should you adopt?
If your application does not have many UI changes when running on either the iPhone or iPad,
using the first technique (modifying the device target setting) is the easiest way to support two platforms with a single code base and a single UI.
All you need to do is to ensure that when the application runs on the iPad, the UI is rearranged correctly this can be done programmatically in your View Controller.
Most developers should benefit from creating Universal applications.
When you have an application that supports two different platforms,
creating a Universal application allows you to have one code base and several XIB files designed specifically for the iPhone and iPad.
This technique and the first save you the trouble of uploading two different editions of your application to AppStore.
You need to upload just one version of your application and it will automatically support both platforms.
The last technique, maintaining two different code bases, is useful if your application behaves differently when it is running on different platforms.
When your application does not support certain features while running on the iPhone, you might have quite a different code base for each platform.
In this case, maintaining different code bases might be a better idea and save you the trouble of bundling all the unnecessary files into a single application.

