UI for iOS: UI control's properties frame bounds Center and transform

Source: Internet
Author: User

These properties, which are internally structured: CGRect cgpoint cgfloat

Background: All controls are sub-classes of view, the screen is a large view, each view has a viewcontroller, it is the view of the butler, each view corresponds to a viewcontroller, to manage the view.

    1. Frame & Bounds & Center

      ========================================

      1 > Frame can modify the object's position and size

      2> Bounds can modify the size of the object

      3> Center can modify the position of the object, which is the x, y coordinate of the center of the object

  

2. end-to-end animations

========================================

Beginanimations indicates that subsequent code will " participate in" the animation

[UIView beginanimations:nil context:nil];

Setanimationduration used to specify the duration of the animation

[UIView setanimationduration:2.0];

self. Headimageview.bounds = rect;

Commitanimations, commits and generates animations for all animations after beginanimation

[UIView commitanimations];

3. Transform Properties

========================================

In OC , you can modify the translation, scaling, and rotation angles of an object by using the transform property

Common methods for creating transform structures are divided into two main categories

1 > Create a deformation based on the initial position of the control

Cgaffinetransformmaketranslation

Cgaffinetransformmakescale

Cgaffinetransformmakerotation

2> create A " based on transform parameter " deformation, return the current coordinate value, do not need to always calculate, this is more commonly

So there will be one more parameter: the current control object;

Cgaffinetransformtranslate

Cgaffinetransformscale

Cgaffinetransformrotate

Add:

In OC , all values associated with the angle are in radians,°= m_pi

Positive number indicates clockwise rotation

Negative number indicates counterclockwise rotation

Tip: Because the transform property can be superimposed on the last state of the control, for example, rotate and then pan

Therefore, in the actual animation development, when it involves the position, the size deformation effect, mostly modifies the control's transform property,

frame bounds Center

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.