总结一下放射变换基本用法
//gradientL自己定义的一个label
//位移
CGAffineTransform transformMove = CGAffineTransformMakeTranslation(100,300);
gradientL.transform = transformMove;
// 缩放(大于1:放大 小于1:缩小)
CGAffineTransform transformScale = CGAffineTransformMakeScale(2, 2);
gradientL.transform = transformScale;
// 旋转
CGAffineTransform transformRota= CGAffineTransformMakeRotation(M_PI);
gradientL.transform = transformRota;
// 组合变换
CGAffineTransform transform1 = CGAffineTransformMakeRotation(M_PI);
CGAffineTransform transform2 = CGAffineTransformScale(transform1, 0.5, 0.5);
gradientL.transform = CGAffineTransformTranslate(transform2, 100, 100);
//矩阵反转
CGAffineTransform transformInvert = CGAffineTransformInvert(CGAffineTransformMakeScale(2, 2));
gradientL.transform = transformInvert;
补充
CGAffineTransformIdentity : 单位矩阵变换,一般用于仿射变换的初始化或者还原。
CGAffineTransformEqualToTransform(CGAffineTransform t1,
CGAffineTransform t2) : 判断两个变换矩阵是否相等
CGAffineTransformConcat(CGAffineTransform t1,
CGAffineTransform t2) : 得到两个矩阵相加后得到的最终矩阵
CGPoint CGPointApplyAffineTransform(CGPoint point,
CGAffineTransform t) : 某点通过矩阵变换之后的点
CGSize CGSizeApplyAffineTransform(CGSize size, CGAffineTransform t) : 某个size通过矩阵变换之后的size
CGRect CGRectApplyAffineTransform(CGRect rect, CGAffineTransform t) : 某个Rect通过矩阵变换之后的区域