视图的框架和视图的边界之间的区别iPhone

发布于 2024-09-27 14:40:20 字数 88 浏览 0 评论 0原文

我想知道 UIView 的“frame”和“bound”属性有什么区别。我使用这两个属性得到相同的结果。我无法弄清楚两者之间的区别..

提前谢谢。

I want to know what is the difference between 'frame' and 'bound' property of UIView. I get the same results using both properties. I can not figure out the difference between the two..

Thanx in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

昵称有卵用 2024-10-04 14:40:20

框架是视图在其超级视图中的位置,使用超级视图的坐标系。

边界是视图在其自身坐标系中的位置和大小。

如果两个属性得到相同的结果,则意味着视图填充了其父视图,并且两个视图都以 (0, 0) 作为原点。尝试更改框架,您将看到它在其超级视图中移动到不同的位置。

The frame is the view's location in its superview, using the superview's coordinate system.

The bounds is the view's location and size in its own coordinate system.

If you are getting the same results for both properties, it means that the view fills its superview, and both views have (0, 0) as the origin. Try changing the frame, and you will see it move to different positions within its superview.

决绝 2024-10-04 14:40:20

这是文档中介绍的 。框架和边界是两个不同的坐标系。

This is covered in the documentation. The frame and bounds are two different coordinate systems.

小红帽 2024-10-04 14:40:20

我知道为时已晚,但由于这是一个常见问题,所以我发布了 链接到苹果文档对此有详细说明

I know its too late but as this a common question so I am posting a link to apple documentation to have a detailed explanation on this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文