您的位置:首页 > 产品设计 > UI/UE

UIView frame bounds center tag 相关知识及区别

2014-05-13 17:11 399 查看
@property(nonatomic) CGRect            frame;
@property(nonatomic) CGRect            bounds;
@property(nonatomic) CGPoint           center;


CGRect:

struct CGRect {
CGPoint origin;
CGSize size;
};
typedef struct CGRect CGRect;CGPoint:
struct CGPoint {
CGFloat x;
CGFloat y;
};
typedef struct CGPoint CGPoint;CGSize:
struct CGSize {
CGFloat width;
CGFloat height;
};
typedef struct CGSize CGSize;

frame:  用来描述视图的大小和位置,其中的CGPoint是从屏幕的左上角作为(0,0)。

bounds:也是用来描述视图的大小和位置,不过他的CGPoint是从自身的左上角作为(0,0)。

区别:



center: 顾名思义,就是视图的中心。

tag:屏幕有很多的视图,为了便于区分,添加不同的tag区分视图。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  frame bounds center tag 区别