iOS development in-depth coordinate system frame, bounds, center, transform different and connected

Source: Internet
Author: User
<span id="Label3"></p><p class="p1"><p class="p1"><span style="color:rgb(51,51,51); line-height:20px">In doubt, please add QQ exchange Group: 390438081</span></p></p><p class="p1"><p class="p1"><span style="color:rgb(51,51,51); line-height:20px">My qq:604886384 (indicated)</span></p></p><p class="p1"><p class="p1"><span style="color:rgb(51,51,51); line-height:20px">: niuting823</span></p></p><p class="p1"><p class="p1">1.1 Frame Property</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>A. What is frame</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Type: CGRect Structural Body (size Origin)</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Role: the position of the left vertex of the view in the coordinate system of the parent view, and the width and height of the view in the parent view</p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>B. Changed frame directly, How do other properties change?</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Bounds: will</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Center: will</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Transform: No</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>C. When to use frame</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>When adding a view to the parent view, be sure to set the Frame property</p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span>1.2 Bounds Properties</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>A. What is the Bounds property</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span><span></span>Type: CGRect Structural Body</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span><span></span>Action: describes the base value of the vertex of the View's own coordinate system, and the size of the view itself</p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>B. How other properties change when you modify the Bounds property directly</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Frame: will</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Center: No</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>Transform: No</p></p><p class="p2"><p class="p2"><br></p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>C. When Bounds property</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>When you need to define a view, when you want to read the size of the parent view, use the size in the parent View's bounds property</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>When you modify the position of a child view within a view, you can modify the starting point of the bounds coordinate system of the view so that the position of the sub-view is shifted to achieve the effect of moving</p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span>1.3 Center Properties</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>A. What is the Center property</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Type: Cgpoint Type</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Role: describes the location of the View's center point in the parent view coordinate system</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>B. Modify the Center property directly and change other properties</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Frame: coordinates-related Values Change</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Bounds: No</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Transform: No</p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>C. When to use center</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span><span></span>You need to modify the position of the view, that is, by modifying the center</p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span>1.4 Transform Properties</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>A. What is the Transform property</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Type: Cgaffinetransform</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Action: describes the deformation state of the view</p></p><p class="p2"><p class="p2"><span></span><span></span><span></span></p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>B. Modify transform directly, How other properties change</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Frame: will</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Bounds: No</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Center: No</p></p><p class="p2"><p class="p2"><br></p></p><p class="p1"><p class="p1"><span></span><span></span><span></span>C. When to use transform?</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>When the view needs to deform (scale, rotate), You can modify the property</p></p><p class="p2"><p class="p2"><span></span><span></span><span></span></p></p><p class="p1"><p class="p1"><span></span><span></span>Conclusion: before deformation frame and bounds maintain the consistency of change, after deformation, frame represents the appearance in the view, so will be recorded with the deformation of different appearance state, so will change, but bounds is not used to record performance, just record size, so will not change, Bounds and center are independent of the deformation coordinate system, and the transform record is the change of the deformation to the drawing coordinate system</p></p><p class="p1"><p class="p1"><span></span><span></span><span></span><span></span>Get the size, read the bounds, want to determine the position, find frame</p></p><p class="p2"><p class="p2"><br></p></p><p><p>iOS development in-depth coordinate system frame, bounds, center, transform different and connected</p></p></span>

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.