@interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem>

/**

*  通过一个frame来初始化一个UI控件

*/

- (id)initWithFrame:(CGRect)frame;

// YES:能够跟用户进行交互

@property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled;  // default is YES

// 控件的一个标记(父控件可以通过tag找到对应的子控件)

@property(nonatomic)                                 NSInteger tag;                // default is 0

// 图层(可以用来设置圆角效果\阴影效果)

@property(nonatomic,readonly,retain)                 CALayer  *layer;

@end

@interface UIView(UIViewGeometry)

// 位置和尺寸(以父控件的左上角为坐标原点(0, 0))

@property(nonatomic) CGRect            frame;

// 位置和尺寸(以自己的左上角为坐标原点(0, 0))

@property(nonatomic) CGRect            bounds;

// 中点(以父控件的左上角为坐标原点(0, 0))

@property(nonatomic) CGPoint           center;

// 形变属性(平移\缩放\旋转)

@property(nonatomic) CGAffineTransform transform;   // default is CGAffineTransformIdentity

// YES:支持多点触摸

@property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled;   // default is NO

@end

@interface UIView(UIViewHierarchy)

// 父控件

@property(nonatomic,readonly) UIView       *superview;

// 子控件(新添加的控件默认都在subviews数组的后面, 新添加的控件默认都显示在最上面\最顶部)

@property(nonatomic,readonly,copy) NSArray *subviews;

// 获得当前控件所在的window

@property(nonatomic,readonly) UIWindow     *window;

// 从父控件中移除一个控件

- (void)removeFromSuperview;

// 添加一个子控件(可以将子控件插入到subviews数组中index这个位置)

- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;

// 交换subviews数组中所存放子控件的位置

- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;

// 添加一个子控件(新添加的控件默认都在subviews数组的后面, 新添加的控件默认都显示在最上面\最顶部)

- (void)addSubview:(UIView *)view;

// 添加一个子控件view(被挡在siblingSubview的下面)

- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;

// 添加一个子控件view(盖在siblingSubview的上面)

- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;

// 将某个子控件拉到最上面(最顶部)来显示

- (void)bringSubviewToFront:(UIView *)view;

// 将某个子控件拉到最下面(最底部)来显示

- (void)sendSubviewToBack:(UIView *)view;

/**系统自动调用(留给子类去实现)**/

- (void)didAddSubview:(UIView *)subview;

- (void)willRemoveSubview:(UIView *)subview;

- (void)willMoveToSuperview:(UIView *)newSuperview;

- (void)didMoveToSuperview;

- (void)willMoveToWindow:(UIWindow *)newWindow;

- (void)didMoveToWindow;

/**系统自动调用**/

// 是不是view的子控件或者子控件的子控件(是否为view的后代)

- (BOOL)isDescendantOfView:(UIView *)view;  // returns YES for self.

// 通过tag获得对应的子控件(也可以或者子控件的子控件)

- (UIView *)viewWithTag:(NSInteger)tag;     // recursive search. includes self

/**系统自动调用(留给子类去实现)**/

// 控件的frame发生改变的时候就会调用,一般在这里重写布局子控件的位置和尺寸

// 重写了这个写方法后,一定调用[super layoutSubviews];

- (void)layoutSubviews;

@end

@interface UIView(UIViewRendering)

// YES : 超出控件边框范围的内容都剪掉

@property(nonatomic)                 BOOL              clipsToBounds;

// 背景色

@property(nonatomic,copy)            UIColor          *backgroundColor; // default is nil

// 透明度(0.0~1.0)

@property(nonatomic)                 CGFloat           alpha;                      // default is 1.0

// YES:不透明  NO:透明

@property(nonatomic,getter=isOpaque) BOOL              opaque;                     // default is YES

// YES : 隐藏  NO : 显示

@property(nonatomic,getter=isHidden) BOOL              hidden;

// 内容模式

@property(nonatomic)                 UIViewContentMode contentMode;                // default is UIViewContentModeScaleToFill

@end

@interface UIView(UIViewAnimationWithBlocks)

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations;

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

@end

最新文章

  1. 如何让用户只能访问特定的数据库(MSSQL)
  2. Java网络编程——IP
  3. 37 网络相关函数(五)——live555源码阅读(四)网络
  4. BZOJ4519: [Cqoi2016]不同的最小割
  5. mongoDB01 介绍
  6. mysql 基础语法
  7. 《大话》之第三者家族 代理 Vs 中介者
  8. 排序算法 Java实现版
  9. fragment之间的信息交互——onActivityResult()不经过Activity
  10. jQuery切换网页皮肤并保存到Cookie示例代码
  11. HttpUtil工具类
  12. 【转廖大神】package.json 包安装
  13. 简单实现 C# 与 Javascript的兼容
  14. STM32 ------ 串口 数据位长度 和 奇偶校验位
  15. Docker安装MySQL
  16. MSSQL获取当前插入的ID号及在高并发的时候处理方式
  17. iml文件
  18. yii新手在实例化models(controller调用models实化化)php warning错误
  19. Linux的date常用操作
  20. Windows Server 2012 R2部署--安装桌面体验

热门文章

  1. 3、href和src的区别
  2. xcode常见错误
  3. Framebuffer的配置及应用——先转载留着,以后一定要弄懂
  4. 一个JQuery发送ajax请求
  5. windows composer安装
  6. cocos2d-js引擎学习笔记
  7. ACdream 1007
  8. Django开发环境配置
  9. JAVA 并发编程关键点
  10. Sass与Compress实战:第五章