UIView
1.常见属性
-
@property(nonatomic,readonly) UIView *superview;
- 获得自己的父控件对象
-
@property(nonatomic,readonly,copy) NSArray *subviews;
- 获得自己的所有子控件对象
-
@property(nonatomic) NSInteger tag;
- 控件的ID(标识),父控件可以通过tag来找到对应的子控件
-
@property(nonatomic) CGAffineTransform transform;
- 控件的形变属性(可以设置旋转角度、比例缩放、平移等属性)
-
@property(nonatomic) CGRect frame;
- 控件矩形框在父控件中的位置和尺寸(以父控件的左上角为坐标原点)
-
@property(nonatomic) CGRect bounds;
- 控件矩形框的位置和尺寸(以自己左上角为坐标原点,所以bounds的x、y一般为0)
-
@property(nonatomic) CGPoint center;
- 控件中点的位置(以父控件的左上角为坐标原点)
-
(void)addSubview:(UIView *)view;
- 添加一个子控件view
-
(void)removeFromSuperview;
- 从父控件中移除
-
(UIView *)viewWithTag:(NSInteger)tag;
- 根据一个tag标识找出对应的控件(一般都是子控件)