qf--adaptation to different size screens (Auto layout: AutoLayout)

Source: Internet
Author: User

Adapting to the UI of a different size device:

Most of the time, our app may be running on different sizes of devices, or the display should not be the same. This requires that the location and size of the controls in the UI cannot be written to death.

For different sizes of UI adaptation, there are generally three countermeasures:

The worst-case: hard coding, to different devices, write different code layout.

Determine the other models in your code to set different positions for each control according to the different dimensions. or listen to the screen, in different states also set a different location and size.

This method is feasible, but the amount of work is very heavy, which makes the egg ache.

autoresizingmasks : It can only complete the relative position of the parent-child view. Instead of resolving the relative position between the sibling views.

Autoresizingmasks can be implemented either through code (enumeration), http://www.cocoachina.com/ios/20141216/10652.html

You can also do this through the visual interface of Xcode.

The best policy :AutoLayout , the relative positions of the parent-child view and the sibling view are resolved. The Blue line represents the constraint to determine the position of the control, and the orange representation does not fully determine the position of the control.

http://www.devtalking.com/articles/adaptive-layout-for-iphone6-1/

qf--adaptation to different size screens (Auto layout: AutoLayout)

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.