[Reprint] iPhone program to iPad program porting Problems

Source: Internet
Author: User

1. Change the iPhone program to an iPad Program

1. First set the target info: reduce the basesdk version to 3.2 to ensure that the program runs on the iPad Program; and set targeted device family to iPhone/iPad; set iPhone OS Deployment target to iPhone OS 3.1.3 or lower.

2. Set Simulator to iPad and run !~

 

2. Convert the iPhone program into a universal program

1. select target and execute project-> upgrade current target to iPad.... In xcode, a dialog box is displayed, in which two modes are selected: one universal application and two device-specific application. If you select the universal mode, a target of the universal is generated. As devices run differently, the universal program will choose to call different style files. Because it is based on the same set of code, you can judge different devices according to the following method:

If (ui_user_interface_idiom () = uiuserinterfaceidiompad)

{

Controller = [[mycontroller alloc] initwithnibname: @ "myipadnib" Bundle: Nil];}

Else

{

Controller = [[mycontroller alloc] initwithnibname: @ "myipodnib" Bundle: Nil];

}

<? XML: namespace prefix = o ns = "urn: Schemas-Microsoft-com: Office: office"/>

Note that the usage of controls is slightly different between iPad and iPhone, so you need to modify the code.

 

 

3. Convert the iPhone program into an iPad Program

1. Similarly, run project-> Upgrade to IPAD. Then select two device-specific application, and the compiler will generate a new target and resources for the program.

2. For interface files other than mainwindow. XIB, you can call file --> Create iPad version in interface builder to convert them to IPAD resolutions.

 

Haha, this conversion is relatively winding. If it has been converted to universal, it seems that it will not work if it is switched back to iPhone. Be careful!

The entire operation process is relatively difficult. You can combine the above article with the actual operation experiment.

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.