平移(Translation)
CGAffineTransform CGAffineTransformMakeTranslation(CGFloat tx, CGFloat ty);
self.tempView.transform = CGAffineTransformMakeTranslation(-100, 100);
缩放(Scale)
,值范围:0-1
CGAffineTransform CGAffineTransformMakeScale(CGFloat sx, CGFloat sy);
self.tempView.transform = CGAffineTransformMakeScale(0.5, 0.5);
旋转(Rotation)
CGAffineTransform CGAffineTransformMakeRotation(CGFloat angle);
self.tempView.transform = CGAffineTransformMakeRotation(-M_PI_4);
效果重叠
CGAffineTransform CGAffineTransformTranslate(CGAffineTransform t,
CGFloat tx, CGFloat ty);
CGAffineTransform CGAffineTransformScale(CGAffineTransform t,
CGFloat sx, CGFloat sy);
CGAffineTransform CGAffineTransformRotate(CGAffineTransform t,
CGFloat angle);
CGAffineTransform translation = CGAffineTransformMakeTranslation(-100, 100);
CGAffineTransform scaleTranslation = CGAffineTransformScale(translation, 0.5, 0.5);
CGAffineTransform rotateScaleTranslation = CGAffineTransformRotate(scaleTranslation, M_PI_2);
self.tempView.transform = rotateScaleTranslation;
CGAffineTransformIdentity
用于清空transform(变换)
,以前的平移、缩放、旋转都会消失 [UIView animateWithDuration:2.0 animations:^{
self.tempView.transform = CGAffineTransformIdentity;
}];