重置变形的UIView的原点会变成疯狂 [英] Resetting the origin of a transformed UIView descends into craziness
问题描述
我使用[UIView transform:]旋转/缩放UIVIew,这很有效。但是,一旦我更改视图的帧原点,即使我没有执行任何进一步的CGAffineTransforms,视图的内容也会开始奇怪地扩展。
I rotate/scale a UIVIew using [UIView transform:] and this works well. However, as soon as I change the view's frame origin the contents of the view begins to scale 'weirdly' even though I am not performing any further CGAffineTransforms.
为什么这样做发生?我该如何预防?
Why does this occur? How can I prevent it?
更新1:
文档建议变换后帧无效。我可以通过它的'center'属性移动视图吗?
The docs suggest that the frame is invalid after a transform. Can I move the view via it's 'center' property instead?
更新2:
设置视图中心确实允许我在应用转换后成功翻译视图。
Setting the views center did allow me to translate the view successfully after a transform had been applied.
推荐答案
我可以通过它的'center'属性移动视图吗?
Can I move the view via it's 'center' property instead?
文档定义了中心
property as:
The documentation defines the center
property as:
框架的中心。
The center of the frame.
并说:
中心是在其超级视图的坐标系内指定的。
The center is specified within the coordinate system of its superview.
我试试。
这篇关于重置变形的UIView的原点会变成疯狂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!