Transform属性

transform本质上是改变了控件的frame

transform基本设置

 // 缩放
        self.tempView.transform = CGAffineTransformMakeScale(0.5, 0.5);
        // 平移
        self.tempView.transform = CGAffineTransformMakeTranslation(-100, 100);
        //旋转
        self.tempView.transform = CGAffineTransformMakeRotation(-M_PI_4);

transform属性的叠加

       CGAffineTransform translation = CGAffineTransformMakeTranslation(-100, 100);
        CGAffineTransform scaleTranslation = CGAffineTransformScale(translation, 0.5, 0.5);
        CGAffineTransform rotateScaleTranslation = CGAffineTransformRotate(scaleTranslation, M_PI_2);
        self.tempView.transform = rotateScaleTranslation;

清空transform,以前的平移、缩放、旋转都会消失

self.tempView.transform = CGAffineTransformIdentity;

你可能感兴趣的:(Transform属性)