Frame vs Bounds
-Usually depends on the context
If you are using a view, typically you use frame
If you are implementing a view, typically you use bounds
Matter of perspective
-From outside it's usually the frame
-From inside it's usually the bounds
Examples;
-Creating a view, positioning a view in superview - use frame
-Handing events, drawing a view - use bounds
应该使用哪一个?
-这通常取决于不同情况。
如果你正在使用一个 view,通常使用 frame
如果你正在实例化一个 view,通常使用 bounds
这取决于看待的角度
-从外面来看,通常是 frame
-从里面看,通常是 bounds
例如:
-创建一个 view,放在 super view 中,使用frame
-处理事件,如绘制一个 view,使用bounds
Check out Apple's guide on View Geometry. They have pretty good examples on what happens when you change bounds and frame values.
from: http://zyc-to.blog.163.com/blog/static/1715240020101130113542374/
-Usually depends on the context
If you are using a view, typically you use frame
If you are implementing a view, typically you use bounds
Matter of perspective
-From outside it's usually the frame
-From inside it's usually the bounds
Examples;
-Creating a view, positioning a view in superview - use frame
-Handing events, drawing a view - use bounds
应该使用哪一个?
-这通常取决于不同情况。
如果你正在使用一个 view,通常使用 frame
如果你正在实例化一个 view,通常使用 bounds
这取决于看待的角度
-从外面来看,通常是 frame
-从里面看,通常是 bounds
例如:
-创建一个 view,放在 super view 中,使用frame
-处理事件,如绘制一个 view,使用bounds
Check out Apple's guide on View Geometry. They have pretty good examples on what happens when you change bounds and frame values.