当前位置: 代码迷 >> 综合 >> uiview 2D变化、3D变化、放大缩小
  详细解决方案

uiview 2D变化、3D变化、放大缩小

热度:44   发布时间:2024-01-22 04:35:27.0

1.2D旋转:

testView.transform = CGAffineTransformMakeRotation(3.14/3);

2.3D旋转

CALayer *layer = testView.layer;CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;rotationAndPerspectiveTransform.m34 = 1.0 / -500;rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0f * M_PI / 180.0f, 0.0f, 1.0f, 0.0f);layer.transform = rotationAndPerspectiveTransform;

3.缩放:

    CGAffineTransform transform = testView.transform;transform = CGAffineTransformScale(transform, 2,2);testView.transform = transform;