Preface
A universal program is also an iphone and ipad version.
Generic:
Advantages:
A package to facilitate management, distribution can share a set of logical code, data structure
Disadvantages:
The installation package will be large: the ipad version of the image is different from the iphone version, and the ipad image size is larger, the backlog, will cause the entire installation package is very large
The various judgments in the code whether or not the ipad's logical branching can lead to code confusion
Two versions of:
Advantages:
App can be designed for ipad and iphone features, respectively.
The installation package is relatively small
Disadvantages:
Two per package, not easy to manage, distribute
Suggestion: If your App,ipad version is similar to the iphone version, make an app that is compatible with the ipad and iphone, or separate the ipad version and iphone version. Premises
Modify target device family (build inside the targeted Device family selected as Iphone/ipad), if not modified, run on the IPad, or the iphone interface, but can "2x" Zoom out, modify target dev After the ice, the display is the ipad interface, the original iphone interface effect on the ipad only part of the screen (iOS 6 after the discovery, regardless of target device is universal, run what device, display the machine interface size, As to whether the display effect is only a part or beyond the screen, see how the code is written. Scenario 1: A set of code and Xib interface files, code split if and else to handle multiple devices separately
Applicable conditions:
iPhone, ipad interface layout, the same proportion, but not the same size, directly in the initWithFrame, Initwithcorder inside do proportional transformation. Scenario 2: A set of code and two sets of Xib interface files, two sets of interface common set of code applicable conditions: iPhone, ipad interface layout is not the same, function, process, business logic is almost Related technology: 1. different logical processing in code:
if (Ui_user_interface_idiom () ==uiuserinterfaceidiompad) {
//ipad version code;
}
else{
//iphone/ipod Touch version code;
}
2. With regard to resource documents:iOS Supports device-specific Resources (Reference: "Resource programming Guide" iOS Supports device-specific Resources section of the official website) : The format is as follows:
<basename><device>.<filename_extension>
Device Description:
generally are: Xxx~ipad.extension + xxx.extension two sets (do not have to xxx~iphone.extension)~ipad-the resource should is loaded on the ipad devices only.
~iphone-the resource should is loaded on the iphone or ipod Touch devices only. means that
Picture
uiimage* animage = [uiimage imagenamed:@ "Myimage.png"];
On a iPhone or ipod touch device, the system loads the Myimage~iphone.png resource file, while on the iPad, it loads the M Yimage~ipad.png resource file. If a device-specific version of a resource is isn't found, the system falls back to looking for a resource with the original filename, which in the preceding example would is an image named Myimage.png
//xib Myviewcontroller *viewcontrol
Ler = [[Myviewcontroller alloc]
initwithnibname:@ "Myviewcontroller" Bundle:nil]
//Load myviewcontroller~ Ipad.xib on a iPad, and myviewcontroller.xib on others devices
//other similar
3. About Initial configuration:
In the Info.plist file,
Launch image, main nib file base name, main storyboard file base name, supported Interface orientationThese are similar and can be set to different versions of the iphone and ipad. There are also two sets of images for Appicon,image.xcasset.
Scenario 3: Two sets of code and Xib interface files, two sets of code and interface are irrelevant
Related technology:
@interface viewcontroller:uiviewcontroller
@end
@interface viewcontroller_ipad:viewcontroller
@end
@interface Viewcontroller_iphone:viewcontroller
@end
Applicable conditions:
iPhone, ipad interface layout is different, function, process, business logic is not the same
------------------------Reference: IPhone porting to ipad:http://blog.csdn.net/ch_soft/article/details/7099534 IOS Supports Device-specific Resources section: "Resource programming Guide"