【UIKit】UIView的常见属性

1.superview 

获得自己的父控件对象

@property(nonatomic,readonly)UIView *superview

 

2.subviews

 获得自己的所有子控件对象

@property(nonatomic,readonly,copy)NSArray *subviews;
    int count=self.view.subviews.count;
    NSLog(@"控件的个数有%d",count);

 

3.tag

控件的ID\标志,父控件可以通过tag来找到相应的子控件

@property (nonatomic)NSInteger tag;

 

4.frame

控件所在的矩形框位置和尺寸(以父控件的左上角为坐标原点)

@property (nonatomic)CGRect frame;

 

5.bounds

控件所在矩形框的位置和尺寸(以自己左上角为坐标原点,所以boundsx\y永远为0

@property (nonatomic)CGRect bounds;

 

6.center

控件中点的位置(以父控件的左上角为坐标原点)

@property(nonatomic)CGPoint center;

 

7.transform

控件的形变属性(可以设置旋转角度、缩放比例、平移等属性)

@property (nonatomic) CGAffineTransform transform;

 

posted @ 2014-04-12 11:49  太过于漂流  阅读(139)  评论(0编辑  收藏  举报