IOS Cgaffinetransform Properties

Source: Internet
Author: User

Transform we are generally called deformation properties, whose essence is to change the size, position, and angle of the control through matrix changes, here we look at the specific operation by an example, and in the following example we see the common operation of the Uiimageview control.

Rotate
-(ibaction) rotationbuttonpressed: (ID) sender
{
    Self.imageView.transform = Cgaffinetransformrotate (Self.imageView.transform, m_pi_4);
}
Zoom
-(ibaction) scalebuttonpressed: (ID) sender
{
    self.imageView.transform = Cgaffinetransformscale ( Self.imageView.transform, 0.9, 0.9);

-(Ibaction) movebuttonpressed: (ID) sender
{
    _imageview.transform = cgaffinetransformtranslate ( Self.imageView.transform, 0);

There are several ways to get cgaffinetransform, such as using Cgaffinetransformmake, but it is relatively cumbersome for matrix operations, In fact, iOS has prepared three methods for us: cgaffinetransformmakerotation (rotate), Cgaffinetransformmakescale (zoom), Cgaffinetransformmaketranslation (move); Transform is rotated, scaled, and moved without incremental deformation on the original basis, so if you need to continue to rotate, scale, Move so each time need to increase or decrease on the basis of the original. Of course, we can define a global variable to add up, but in fact iOS has provided us with three corresponding methods, respectively, for the original angle, zoom, mobile location based on the changes: Cgaffinetransformrotate, Cgaffinetransformscale, Cgaffinetransformtranslate;


Related Article

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.