transfrom可以实现一些形变。常见的有平移、缩放和旋转三种。使用起来很简单:
//横纵放大1.3倍
                self.imageButton.transform=CGAffineTransformScale(self.imageButton.transform, 1.3, 1.3);
//逆时针旋转180度 (加上y0.000001是因为旋转180°会默认顺时针)
                self.imageButton.transform=CGAffineTransformRotate(self.imageButton.transform, -M_PI+0.000001);

 //平移
                self.imageButton.transform=CGAffineTransformTranslate(self.imageButton.transform, 100, 0);

以上都是保存了形变的状态的。如果单独使用不会有问题。但是当我们旋转后再平移的话就发现不是我们想要的结果。如果我们顺时针旋转45度,再向X轴平移100点,那么再界面上就是斜着平移了100点。这是因为transfrom是通过更改坐标系来实现形变的。所以使用时应注意。

相关文章:

  • 2021-05-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-08-14
  • 2022-12-23
  • 2021-08-19
  • 2021-05-13
猜你喜欢
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2021-06-17
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案