可以分为在view层的变换和在layer层的变化:
角度的变换:
layerView.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_4))// view层有属性transform
layerView.layer.setAffineTransform(CGAffineTransformMakeRotation(CGFloat(M_PI_4)))// layer 层有方法setAffineTransform
放大缩小:
layerView.transform=CGAffineTransformMakeScale(1.5,1.5) // view层的方法缩小
layerView.layer.setAffineTransform(CGAffineTransformMakeScale(1.5,1.5))// layer层的放大缩小
如果要做多样的变化:
1. vartransform =CGAffineTransformIdentity //申明
2. transform =CGAffineTransformRotate(transform,CGFloat(M_PI_4))
3. transform =CGAffineTransformTranslate(transform,30,100)
4. layerView.transform= transform
网友评论