Ios-ui-transform

Source: Internet
Author: User

/Viewwithtag: Pass a tag value, view will find the corresponding view according to the tag value
UILabel *label = [Self.view viewwithtag:10];

Once the Addsubview is executed: The time is equal to self. View has a strong pointer to the view being added
[Self.view Addsubview:button];

Use the weak modifier later when defining UI control properties
@property (nonatomic, weak) UIButton *button;

Instantiating a button
UIButton *button = [[UIButton alloc] initwithframe:cgrectmake (100, 100, 200, 200)];

Assign a value to a global property
Self.button = button;

/**
The nature of property
Set method
Get method
_ Property Name
*/

I. Transform properties, making deformation
Translation:
Cgaffinetransformmaketranslation (10, 0): Panning based on the initial position
Cgaffinetransformtranslate (Self.redView.transform, 10, 0) can take effect multiple times, based on the current state

Rotating:
Cgaffinetransformmakerotation:angle: Is Radian
M_pi_4:45°

If the pass value is negative: rotate counterclockwise

Cgaffinetransformmakerotation (M_pi_4)
Cgaffinetransformrotate (Self.redView.transform,-m_pi_4)

Scaling:
Cgaffinetransformmakescale (1.2, 1.2): 1.2 times magnification on x-axis, 1.2 times magnification on y-axis

If you want to zoom out, pass a value less than 1, and if you pass it as a negative, the view is insane.

Cgaffinetransformmakescale (1.2, 1.2)
Cgaffinetransformscale (Self.redView.transform, 0.8, 0.5)

When the transform of the view changes, it affects the frame, so if you animate, use bounds and center instead.
Animatable. Don't use frame if view is transformed since it won't correctly reflect the actual location of the view. Use bounds + Center instead

Ios-ui-transform

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.