我对UIKit中的帧和边界有正确的理解吗? [英] Do I have the right understanding of frames and bounds in UIKit?

查看:91
本文介绍了我对UIKit中的帧和边界有正确的理解吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我试着解释一下。请告诉我,如果我错了。我只有70%肯定它。

Let me try to explain it. Please tell me if I am wrong. I am just 70% sure about it.

就像我理解的那样,UIView有一个框架和一个边界矩形。
框架矩形的作用是设置UIView相对于它的超视图的位置。更确切地说:相对于superview的坐标系。边界矩形的工作是相对于它自己的坐标系设置UIView的绘图区域。

Like I understand it, an UIView has a frame and an bounds rectangle. The job of the frame rectangle is to set the position of the UIView relative to it's superview. More precisely: Relative to the coordinate system of the superview. The job of the bounds rectangle is to set the drawing area of the UIView, relative to it's own coordinate system.

简要说明:


  • 框架矩形用于相对于其超视图定位UIView

  • bounds矩形用于设置UIView的绘图区域

我错过了哪些错误或重要事项?

Are there any mistakes or important things I missed?

推荐答案

查看有关查看几何图形的Apple指南。当你改变边界和帧值时,它们有很好的例子。

Check out Apple's guide on View Geometry. They have pretty good examples on what happens when you change bounds and frame values.

这篇关于我对UIKit中的帧和边界有正确的理解吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆