frame和bounds的区别,boundsVS applicationframe

来源:互联网 发布:编程语言有什么用 编辑:程序博客网 时间:2024/06/05 21:14

1.

frame和bounds是UIView中的两个属性(property)。

frame指的是:该view在父view坐标系统中的位置和大小。(参照点是父亲的坐标系统)

bounds指的是:该view在本身坐标系统中 的位置和大小。(参照点是本身坐标系统)

-(CGRect)frame{  return CGRectMake(self.frame.origin.x,self.frame.origin.y,self.frame.size.width,self.frame.size.height);}
-(CGRect)bounds{  return CGRectMake(0,0,self.frame.size.width,self.frame.size.height);}
2.

ApplicationFrame is the screen size minus the size of the status bar (if visible), bounds is the screen size regardless of status bar.

So applicationFrame would return CGRectMake(0,0,320,460) assuming your app has the status bar set to be visible, while bounds would return CGRectMake(0,0,320,480) under the same conditions. Those numbers are assuming iPhone/iPod Touch screen sizes.

0 0
原创粉丝点击