iOS开发 frame 与 bounds 的区别与关系

来源:互联网 发布:发闪图的交友软件 编辑:程序博客网 时间:2024/05/14 06:00

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);}
本文原始链接:http://unmi.cc/ios-bounds-frame, 来自:隔叶黄莺 Unmi Blog