iOS

UIView

2016-08-13  本文已影响2人  heckapple

UIView的认识

控件的共同属性

父控件子控件的认识

@property(nonatomic,retain) UIView *view;

UIView的常见属性

@property(nonatomic,readonly) UIView *superview;
// 数组元素的顺序决定着子控件的显示层级顺序(下标越大的,越显示在上面)
@property(nonatomic,readonly,copy) NSArray *subviews;
@property(nonatomic) NSInteger tag;
@property(nonatomic) CGAffineTransform transform;
@property(nonatomic) CGRect frame;
@property(nonatomic) CGRect bounds;
@property(nonatomic) CGPoint center;

UIView的常见方法

//使用这个方法添加的子控件会被塞到subviews数组的最后面
 - (void)addSubview:(UIView *)view;
 - (void)removeFromSuperview;
 - (UIView *)viewWithTag:(NSInteger)tag;
 - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
 - (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
 - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;
 - (void)bringSubviewToFront:(UIView *)view;
 - (void)sendSubviewToBack:(UIView *)view;

UIKit坐标系

上一篇 下一篇

猜你喜欢

热点阅读