为什么要旋转imageView,它会改变位置? [英] Why rotating imageView, it changes position?

查看:81
本文介绍了为什么要旋转imageView,它会改变位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用时:ImageView.transform = CGAffineTransformRotate(ImageView.transform,rotation);每次我旋转imageView和NSLog(@"x:%f y:%f",ImageView.frame.orgin.x,ImageView.frame.orgin.y)时,x和y总是会更改值?为什么?

when I use: ImageView.transform = CGAffineTransformRotate(ImageView.transform, rotation); everytime I rotate imageView and I NSLog(@"x:%f y:%f", ImageView.frame.orgin.x, ImageView.frame.orgin.y), x and y always change value?? Why?

推荐答案

UIView

警告:如果此属性不是恒等变换,则frame属性的值未定义,因此应忽略.

Warning: If this property is not the identity transform, the value of the frame property is undefined and therefore should be ignored.

关于UIView的transform属性.由于您要分配给变换,因此很有可能不再是标识变换,因此帧值是不确定的,应该忽略.

regarding the transform property of a UIView. Since you are assigning to the transform it is most likely not the identity transform any more, hence the frame value is undefined, and should be ignored.

这篇关于为什么要旋转imageView,它会改变位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆