A universal program or iphone, ipad two versions?

Source: Internet
Author: User

Common:

Advantages:

An installation package for easy management and distribution

Can share a set of logic code, data structure
Disadvantages:
The installation package will be large: the ipad version is not the same as the iphone version, and the ipad image size is larger and the backlog will cause the entire installation package to be large
The code's various judgments about whether the ipad's logical branch can lead to code confusion
Two versions of:
Advantages:
The app can be designed for ipad and iphone features individually
The installation package is relatively small
Disadvantages:
Two per package, not easy to manage, distribute

Recommendation: If your app,ipad version is the same as the iphone version, do ipad and iphone apps, or you can do the ipad and iphone version separately.

Prerequisites

Modify target device family (build targeted device family selected as Iphone/ipad), if not modified, run on IPad, or iphone interface, but can "2x" Zoom out, modify the target Device, the display is the ipad interface, the original iphone interface effect on the ipad is only part of the screen (iOS 6 found that regardless of whether the target device is universal, what device to run, display the machine interface size, As to whether the display effect is only part or beyond the screen, see how the code is written)

Scenario 1: A set of code and Xib interface files, code, if and else to handle multiple devices separately
Style= "Color:rgb (204, 0, 0); Font-weight:bold; Font-family:arial, Helvetica, Sans-serif; "> Applicable conditions:</span>
iPhone, ipad interface layout, the same proportions, except the size of the same, directly in the initWithFrame, Initwithcorder to 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 similar Related technologies:1. different logic processing in the code:
Touch version Code;}
2. About resource files: iOS Supports device-specific resources (Reference: Resource Programming Guide, iOS Supports D Evice-specific Resources Section): The format is as follows:
<basename><device>.<filename_extension>
 device Description: generally: 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 be loaded on iphone or iPod touch devices only.          means,
Touch device, the system loads the Myimage~iphone.png resource file, while on IPad, it loads the myimage~ipad.png resource File.  If a device-specific version of a resource is not 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//xibmyviewcontroller *viewcontroller = [[My Viewcontroller alloc]                                      initwithnibname:@ "Myviewcontroller" bundle:nil]//load myviewcontroller~ipad.xib on an ipad , and Myviewcontroller.xib on other devices//similar
3. About the initial configuration:

in the Info.plist file, Launch image, main nib file base name, main storyboard, file base name, supported           Interface Orientation These similar, can be set to iphone, ipad different version. There are also two sets of pictures for Appicon,image.xcasset. Scenario 3: Two sets of code and Xib interface files, two sets of code and interface are irrelevant Related technologies:
@interface Viewcontroller: [email protected] @interface Viewcontroller_ipad: [email protected] @interface Viewcontroller_iphone: [Email protected]
Applicable conditions: iPhone, ipad interface layout is different, function, process, business logic is not the same
------------------------Reference: IPhone ported to Ipad:http://blog.csdn.net/ch_soft/article/details/7099534ios Supports Device-specific Resources section: "Resource Programming Guide"

A universal program or iphone, ipad two versions?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.