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

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

问题描述

让我试着解释一下.如果我错了,请告诉我.我只有 70% 的把握.

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

据我所知,UIView 有一个框架和一个边界矩形.框架矩形的工作是设置 UIView 相对于它的超级视图的位置.更准确地说:相对于父视图的坐标系.边界矩形的工作是设置 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 rectangle 是设置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天全站免登陆