Knowledge Points: Control Transform properties
There are three ways to change the shape of a control
1,cgaffinetransformmaketranslation (PAN)
2,cgaffinetransformmakescale (contraction)
3,cgaffinetransformmakerotate (swivel)
First, actual combat
Create the project first, and add a uiimageview to the project, with three buttons translated, shrunk, rotated,
Add an output source for Uiimageview, three keys to add an output event
Here's where the real code implementation begins.
Cgaffinetransformmaketranslation Demo
TX is the x-coordinate of the control offset
Ty is the y-coordinate of the control offset
This demo is implemented to move the control down
int tx=self. Imageshow. Transform. TX;
int ty=self. Imageshow. Transform. Ty+1;
self. Imageshow. Transform=cgaffinetransformmaketranslation(TX, ty);
Cgaffinetransformmakescale Demo
Global variables
Float sx=1.0,sy=1.0
Cgaffinetransformmakescale inside the parameter Sx,sy value range 0-1, is the control scaling size, I define the global variable is to change the size of the control is defined.
sx+=0.1;xy+=0.1;
self. Imageshow. Transform=cgaffinetransformmakescale(SX, Sy);
Cgaffinetransformmakerotate Demo
Define global variables float angle=0;
Angele value range-1---0---1 is the angle of the control rotation
angle+=0.1;
self. Imageshow. Transform=cgaffinetransformmakerotation(Angel);
IOS---transform (control position, size, rotation change)