问题描述
什么时候UIView的bounds.origin
不是(0, 0)
?
When would an UIView's bounds.origin
not be (0, 0)
?
本段对我有帮助:
但是它仅描述了我自己设置bounds.origin
值时的情况.
在其他情况下,bounds.origin != (0, 0)
的值是什么?
But it describes only the case when I had set the value of bounds.origin
myself.
In what other cases the value of bounds.origin != (0, 0)
?
推荐答案
(再次编辑,因为在接受原始答案后我无法将其删除-贷记给ian,后者在下面发布了更详尽的答案:)
(edited again because I can’t delete my original answer after it was accepted—credit for this goes to ian, who posted a more thorough answer below:)
在大多数情况下,这种情况不会发生.如果您使用宽度和/或高度为负的值初始化视图,则会获得宽度为负X和/或高度为负Y的原点.
In most cases this won’t happen. If you initialize your view with a negative width and/or height, you’ll get an origin with a negative X of the width and/or negative Y of the height.
这篇关于什么时候UIView的bounds.origin不会是(0,0)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!