Iphone development adaptation to iphone 5

Source: Internet
Author: User

When the iPhone 5 comes out, we will adapt to screens with different resolutions like android.

The new version of the company's products must be adapted to the iPhone 5. After some effort, it is done. I will share with you the screen resolution of iPhone 5: 1136x640, that is, when the height is changed to, the name of the photo is default-568h@2x.png. When we create a project, xcode creates a pure black image by default. The latest version of xcode supports debugging for iphone 5: select the simulator ----> device ----> iphone (Retina 4-inch). You can switch to the iphone 5 simulator in a moment. To adapt to iPhone 5, you need to set the autosizing of the view to the following status: corresponding code: [cpp] autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin ;. autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin; this means that when the control is scaled, it corresponds to the left and top of the parent view. You can set the autorizingMask value for the Child control as needed. We can also use the code to manually change the size or location of the control under the iPhone 5: first determine whether the device is iphone5: [cpp] # define DEVICE_IS_IPHONE5 ([UIScreen mainScreen] bounds]. size. height = 568) # define DEVICE_IS_IPHONE5 ([UIScreen mainScreen] bounds]. size. height = 568) Then we can change frame: [cpp] if (DEVICE_IS_IPHONE5) {[botton setFrame: CGRectMake (0,450,320,440)];} if (DEVICE_IS_IPHONE5) during view initialization) {[botton setFrame: CGRectMake (0,450,320,440)];}

Related Article

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.