ios - "value of the frame property is undefined and should not be modified"的含义?

标签 ios uiview

所以在 UIView 文档中你有:

However, if the transform property contains a non-identity transform, the value of the frame property is undefined and should not be modified. In that case, you can reposition the view using the center property and adjust the size using the bounds property instead.

很明显,在应用转换后,我不应该更改 frame 的值来重新定位或调整它的大小,但是 frame 中的值是否仍然有效并使感觉?即我仍然可以使用它们进行计算吗?

在我应用转换的 UIImageView 中,bounds 中的值根本没有改变,似乎反射(reflect)了 UIImageView< 的大小 改造前。

最佳答案

文档非常清楚 -

the value of the frame property is undefined

因此,如果安装了非恒等式转换,则不能依赖 frame 属性来获得合理的值。

关于ios - "value of the frame property is undefined and should not be modified"的含义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28820774/

相关文章:

ios - 模拟器(iOS)结果不一致?

ios - UIView 动画的持续时间比指定的快得多

ios - 在可重用的 UIView 中,我应该将 UIButtons 的选择器放在哪里?

ios - 作为 MTKView subview 的 UIView 是否在 GPU 上处理/渲染?

iphone - 如何在放大点向 UIView 添加按钮?

ios - 在现有 iPhone 项目和 Watch Kit 扩展之间共享类

ios - UIBezierPath 未正确渲染

iphone - 如何在方向更改后调整 UIView 的大小(包含的代码似乎不起作用)

ios - 以编程方式创建带有按钮目标的自定义 View

ios - 具有嵌套 NSDictionary 的 AFNetworking POST 方法