UIView 的Transform。(旋转,缩放,3D旋转)

本文介绍了如何使用SwiftUI进行2D旋转和3D旋转及缩放的操作,包括使用CGAffineTransform和CATransform3D进行变换的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://blog.sina.com.cn/s/blog_4b657a0601014bld.html


2D旋转:

map.transform = CGAffineTransformMakeRotation(3.14/3);


3D旋转

 

       CALayer *layer = map.layer;

    CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;

    rotationAndPerspectiveTransform.m34 = 1.0 / -500;

    rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform,45.0f * M_PI / 180.0f0.0f1.0f0.0f);

    layer.transform = rotationAndPerspectiveTransform;


缩放:

 

    CGAffineTransform transform = map.transform;

    transform = CGAffineTransformScale(transform, 2,2);

    map.transform = transform;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值