iphone中cocoa里frame和bounds 的区别
来源:互联网 发布:擒妖股主图指标源码 编辑:程序博客网 时间:2024/05/14 15:44
The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.
The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
So, imagine a view that has a size of 100x100 (width x height) positioned at 25,25 (x,y) of its superview. The following code prints out this view's bounds and frame:
And the output of this code is:
So, we can see that in both cases, the width and the height of the view is the same regardless of whether we are looking at the bounds or frame. What is different is the x,y positioning of the view. In the case of the bounds, the x and y coordinates are at 0,0 as these coordinates are relative to the view itself. However, the frame x and y coordinates are relative to the position of the view within the parent view (which earlier we said was at 25,25).
There is also a great presentation that covers UIViews. See slides 1-20 which not only explain the difference between frames and bounds but also show visual examples.
- iphone中cocoa里frame和bounds 的区别
- iPhone中frame与bounds的区别
- iPhone中frame与bounds的区别
- iOS 中frame 和 bounds 的区别
- iOS中frame和bounds的区别
- iOS中frame和bounds的区别
- iOS中frame和bounds的区别
- iphone UIView中bounds和frame的差别?
- frame 和bounds 的区别
- bounds和frame的区别
- frame和bounds的区别
- frame 和 bounds 的区别
- frame和bounds的区别
- frame和bounds的区别
- frame和bounds的区别
- frame和bounds的区别
- bounds和frame的区别
- frame和bounds的区别
- 嵌入式web服务器预研报告(转)
- WCF 跟踪日志
- C++ 学习之构造函数:构造函数小结1
- 抽象类和接口的区别
- 一个轻量级的分页框架
- iphone中cocoa里frame和bounds 的区别
- 常用日期函数
- 过桥问题求解
- Format the time
- Android调用平台功能
- Ubuntu系统安装VMware Tools的简单方法
- java 找不到类 自己写的类
- CentOS 如何启动 FTP service
- 女儿米菲儿的照片