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;