Lan Yi iOS page layout autolayou

Source: Internet
Author: User

Today touch the page layout of things, Liu Guobin teacher in detail in the form of graphic programming and code will be solved again. Code and Stroyboard feeling are more troublesome, and logical thinking requirements are relatively high.

The editor menu has a resolve Auto Layout issues submenu. From this menu, select Update Constraints. In my case, this would tell interface Builder to make the constraint 64 points, like this:

Well, the t-bars is blue again, the layout is effective. In document outline, you can see that the horizontal space constraint no longer has a standard interval:

So far you've tried horizontal space and vertical space constraints. There is also a "center" constraint. Drag a New button object to the center of the bottom of the canvas, depending on the position to which the wire is intact:

To keep the button centered in the horizontal direction to the parent view, you need to add a center X alignment constraint. Select Align\horizontal Center in Container from the editor menu. This adds a very long orange segment:

The line is orange because you only specify the x axis of the button, but the y-axis does not specify a constraint. Use the Editor\pin menu to add a vertical space constraint between the button and the bottom of the view. Looks like this:

If you don't know the reason, this is the bottom Space to superview option. The Vertical space constraint keeps the button away from the bottom of the view (once again using the standard interval).

Run the program and rotate it to the horizontal screen mode. Even in landscape mode, the button remains at the center of the bottom of the screen:

That's what you mean---this button should always be centered at the bottom. Notice that you don't have to tell the Interface Builder button what the coordinates are, unless you want to pin it on the view.

Classification:Uncategorized | comments: 0 | Views:1 | favorites | Give him a reward .

Lan Yi iOS page layout autolayou

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.