ios CGAffineTransformScale缩放 中心点问题

iOS 码拜 8年前 (2016-03-28) 2724次浏览
代码如下,很简单,做一个当前view的缩放动画
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.5f, 0.5f);
[UIView commitAnimations];
但现在缩放的中心点是view的中心点,达不到本人的要求,可不可以动态的确定缩放中心点?
解决方案

20

变换的原点是layer的anchorPoint,默认是0.5 0.5,也就是中点。

20

想围绕某点缩放? 导入QuartzCore框架 操作view的layer,先改变他的锚点再缩放就好了。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明ios CGAffineTransformScale缩放 中心点问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)