Layouts in iOS

Source: Internet
Author: User

1.UIView has three more important layout properties: frame, bounds and center, Calayer are called frame, bounds, and position. To be clear, the layer uses "position" and the View uses "center", but they all represent the same value.

2.frame represents the outer coordinates of the layer (that is, the space occupied on the parent layer), bounds is the internal coordinate ({0, 0} is usually the upper-left corner of the layer), and center and position represent the location relative to the parent layer anchorpoint.

3. The frame, bounds, and center properties of the view are simply access methods, and when the frame that manipulates the view is actually changing the frame under the view calayer, it is not possible to change the view frame independently of the layer.

For a view or layer, frame is not a very clear attribute, it is actually a virtual property, calculated based on bounds, position, and transform, so when any of these values change, the frame will change. Conversely, changing the value of a frame also affects the values in them.

Remember that when you transform a layer, such as rotation or zoom, the frame actually represents a rectangular area that spans the entire axis aligned after the layer is rotated, which means that frame's width and height may no longer be the same as the bounds width.

4.frame, position and Anchorpoint have the following relationship:

frame.origin.x = Position.x-anchorpoint.x * bounds.size.width;

FRAME.ORIGIN.Y = Position.y-anchorpoint.y * bounds.size.height;

5.position and Anchorpoint are coincident points in different coordinate spaces, and modifying the position of coincident points in one coordinate space does not affect the position of the coincident point in another coordinate space

Reference

Advanced skill layer Geometry for iOS core animations

Layouts in iOS

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.