IOS development-iPhone 6/6 Plus adaptation

Source: Internet
Author: User

IOS development-iPhone 6/6 Plus adaptation

It took some time to reorganize the iPhone adaptation, which is summarized as follows:


Before iOS6, autosize is generally used for screen adaptation, and the size relationship defect between the view and the parent view is set: (Autosizing layout is insufficient) 1. the relationship between views cannot be set. 2. you cannot set the maximum size for resizing. After the minimum value is iOS6, use the automatic layout. AutoLayoutiOS8 size classes (more abstract, square)

In addition, some mainstream device parameters are as follows:

IPhone IPhone 4 IPhone 5 IPhone 6 IPhone6 +
Point 320*480 320*480 320*568 375*667 414*736
Pixel 320*480 640*960 640*1136 750*1334 1242*2208
Pexel (device) ~ ~ ~ ~ 1920*1080
Scale 1 2 2 2 3
PPI 163 326 326 326 401

That is to say, if you want to adapt to iPhone 6 Plus now. Then you need to provide another set of @ 3x images. (previously there was only one set of regular sets, one set of @ 2x) You can view the values in Scale.

To put it simply: iPhone4, iPhone5, and iPhone6 have the same ppi, and the default image priority is @ 2x. The pixel density of iPhone 6 Plus is higher. The default image priority is @ 3x.

In addition, the iPhone 6 Plus has a difference from other devices: the screen resolution obtained within the App is 1242*2208, but the actual resolution of the device is 1920*1080, at this time, the system will scale the overall display content, and the downscale will reach 1/1. 15. This feature has also appeared in OSX:



Since the Xcode6 GM version, the simulator has added two new types: iPhone 6 and iPhone 6 Plus. If the old project runs directly to these two simulators, the default mode is "compatible ", that is, the system simply scales up the content and other proportions, and the display effect is vague but acceptable. The device resolution obtained by the App is the same as that obtained by the iPhone 5: 320*568 point.

That is to say, your original project is not compatible with iPhone 6 plus. But there is no problem when running on iPhone 6 plus. At this time, the device resolution will be the same as 5. 320*568. That is, iPhone 6 plus is applicable to your application, rather than your application. This makes the resolution of 6 useless.

Therefore, we need to manually enable the high-resolution mode.

Enable High Resolution Mode

There are two ways to enable high resolution mode (which I can find currently ):

1. Add the LaunchImage of the screen:
In Images. xcassets, delete the old LaunchImage group, create a new LaunchImage group, and add the corresponding high-resolution Images. Here is a more detailed graphic Introduction: How to Add a Launch Image for the iPhone 6. If you want to quickly test the new effect, three sample images can be downloaded.

2. Add Launch Screen File

Launch Screen is a newly added feature of Xcode6 and iOS8. It uses an xib file as the startup Screen. This attribute is automatically ignored when the App is started in the old iOS version, without exceptions.
First, click New File> iOS User Interface> Launch Screen and enable it in the Project Settings:

If either of the above settings is enabled, the App enters the high-resolution mode. However, if the two settings are not enabled, the App will go back to the compatible mode. Since many apps still need to be compatible with iOS5, and the first method may have bugs in iOS5, the second method is recommended here.



Therefore, to adapt to these devices, you must learn autolayout. Of course, this is just my personal suggestion.

In addition, you need to prepare a copy of The @ 3x image.

In addition, the high-resolution mode must be enabled.

Then, observe the 6 + simulator carefully, and its desktop can be displayed horizontally. Therefore, we should try our best to adapt our applications to the landscape screen as far as possible.


The following are some learning materials:


Tutorial on Automatic Layout in iOS 7 (1)
Http://www.cocoachina.com/industry/20131203/7462.html
(Translation) Start iOS 7 Automatic Layout tutorial (2)
Http://www.cnblogs.com/zer0Black/p/3977288.html


Big screen iPhone adaptation
Http://blog.ibireme.com/2014/09/16/adapted_to_iphone6/

Infinite interconnection iPhone6 adaptation tutorial all video cloud disk Download Links
Download link: http://pan.baidu.com/s/1kTgK4AF password: p7yp


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.