问题
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?
回答1:
Well the .frame.origin
is the top left corner of you UIImageView
and since you are rotating it the top left corner is moving. If you access the .center
it should stay the same.
回答2:
The UIView documentation states that
Warning: If this property is not the identity transform, the value of the frame property is undefined and therefore should be ignored.
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.
来源:https://stackoverflow.com/questions/13786908/why-rotating-imageview-it-changes-position