1 @interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem>
2
3 /**
4 * 通过一个frame来初始化一个UI控件
5 */
6 - (id)initWithFrame:(CGRect)frame;
7
8 // YES:能够跟用户进行交互
9 @property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is YES
10
11 // 控件的一个标记(父控件可以通过tag找到对应的子控件)
12 @property(nonatomic) NSInteger tag; // default is 0
13
14 // 图层(可以用来设置圆角效果\阴影效果)
15 @property(nonatomic,readonly,retain) CALayer *layer;
16
17 @end
18
19 @interface UIView(UIViewGeometry)
20 // 位置和尺寸(以父控件的左上角为坐标原点(0, 0))
21 @property(nonatomic) CGRect frame;
22
23 // 位置和尺寸(以自己的左上角为坐标原点(0, 0))
24 @property(nonatomic) CGRect bounds;
25
26 // 中点(以父控件的左上角为坐标原点(0, 0))
27 @property(nonatomic) CGPoint center;
28
29 // 形变属性(平移\缩放\旋转)
30 @property(nonatomic) CGAffineTransform transform; // default is CGAffineTransformIdentity
31
32 // YES:支持多点触摸
33 @property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled; // default is NO
34 @end
35
36 @interface UIView(UIViewHierarchy)
37 // 父控件
38 @property(nonatomic,readonly) UIView *superview;
39
40 // 子控件(新添加的控件默认都在subviews数组的后面, 新添加的控件默认都显示在最上面\最顶部)
41 @property(nonatomic,readonly,copy) NSArray *subviews;
42
43 // 获得当前控件所在的window
44 @property(nonatomic,readonly) UIWindow *window;
45
46 // 从父控件中移除一个控件
47 - (void)removeFromSuperview;
48
49 // 添加一个子控件(可以将子控件插入到subviews数组中index这个位置)
50 - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
51
52 // 交换subviews数组中所存放子控件的位置
53 - (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;
54
55 // 添加一个子控件(新添加的控件默认都在subviews数组的后面, 新添加的控件默认都显示在最上面\最顶部)
56 - (void)addSubview:(UIView *)view;
57
58 // 添加一个子控件view(被挡在siblingSubview的下面)
59 - (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
60
61 // 添加一个子控件view(盖在siblingSubview的上面)
62 - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;
63
64 // 将某个子控件拉到最上面(最顶部)来显示
65 - (void)bringSubviewToFront:(UIView *)view;
66
67 // 将某个子控件拉到最下面(最底部)来显示
68 - (void)sendSubviewToBack:(UIView *)view;
69
70 /**系统自动调用(留给子类去实现)**/
71 - (void)didAddSubview:(UIView *)subview;
72 - (void)willRemoveSubview:(UIView *)subview;
73
74 - (void)willMoveToSuperview:(UIView *)newSuperview;
75 - (void)didMoveToSuperview;
76 - (void)willMoveToWindow:(UIWindow *)newWindow;
77 - (void)didMoveToWindow;
78 /**系统自动调用**/
79
80 // 是不是view的子控件或者子控件的子控件(是否为view的后代)
81 - (BOOL)isDescendantOfView:(UIView *)view; // returns YES for self.
82
83 // 通过tag获得对应的子控件(也可以或者子控件的子控件)
84 - (UIView *)viewWithTag:(NSInteger)tag; // recursive search. includes self
85
86 /**系统自动调用(留给子类去实现)**/
87 // 控件的frame发生改变的时候就会调用,一般在这里重写布局子控件的位置和尺寸
88 // 重写了这个写方法后,一定调用[super layoutSubviews];
89 - (void)layoutSubviews;
90
91 @end
92
93 @interface UIView(UIViewRendering)
94 // YES : 超出控件边框范围的内容都剪掉
95 @property(nonatomic) BOOL clipsToBounds;
96
97 // 背景色
98 @property(nonatomic,copy) UIColor *backgroundColor; // default is nil
99
100 // 透明度(0.0~1.0)
101 @property(nonatomic) CGFloat alpha; // default is 1.0
102
103 // YES:不透明 NO:透明
104 @property(nonatomic,getter=isOpaque) BOOL opaque; // default is YES
105
106 // YES : 隐藏 NO : 显示
107 @property(nonatomic,getter=isHidden) BOOL hidden;
108
109 // 内容模式
110 @property(nonatomic) UIViewContentMode contentMode; // default is UIViewContentModeScaleToFill
111 @end
112
113 @interface UIView(UIViewAnimationWithBlocks)
114 + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
115 + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
116
117 + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations;
118 + (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;
119 @end

无意进去UIView随笔闹腾着玩 -by 胡 xu的更多相关文章

  1. iOS的非常全的三方库,插件,大牛博客

    转自: http://www.cnblogs.com/zyjzyj/p/6015625.html github排名:https://github.com/trending, github搜索:http ...

  2. iOS开发之资料收集

    github排名:https://github.com/trending, github搜索:https://github.com/search. 此文章转自github:https://github ...

  3. iOS 第三方库、插件、知名博客总结

    iOS 第三方库.插件.知名博客总结 用到的组件 1.通过CocoaPods安装 项目名称 项目信息 AFNetworking 网络请求组件 FMDB 本地数据库组件 SDWebImage 多个缩略图 ...

  4. iOS -- 开源项目和库

    TimLiu-iOS 目录 UI 下拉刷新 模糊效果 AutoLayout 富文本 图表 表相关与Tabbar 隐藏与显示 HUD与Toast 对话框 其他UI 动画 侧滑与右滑返回手势 gif动画 ...

  5. iOS非常全的第三方库

    iOS ● 非常全的三方库.插件.大牛博客等等   github排名:https://github.com/trending, github搜索:https://github.com/search. ...

  6. ios很好的开源库

    Tim9Liu9/TimLiu-iOS 自己总结的iOS.mac开源项目及库,持续更新.. 目录 UI 下拉刷新 模糊效果 AutoLayout 富文本 图表 表相关与Tabbar 隐藏与显示 HUD ...

  7. iOS开发 非常全的三方库、插件、大牛博客等等

    UI 下拉刷新 EGOTableViewPullRefresh- 最早的下拉刷新控件. SVPullToRefresh- 下拉刷新控件. MJRefresh- 仅需一行代码就可以为UITableVie ...

  8. WMPlayer

    WMPlayer视频播放器,AVPlayer的封装,继承UIView,想怎么玩就怎么玩.支持播放mp4.m3u8.3gp.mov,网络和本地视频同时支持.全屏和小屏播放同时支持.自动感应旋转屏幕. 1 ...

  9. iOS:iOS开发非常全的三方库、插件等等

    iOS开发非常全的三方库.插件等等 github排名:https://github.com/trending, github搜索:https://github.com/search. 此文章转自git ...

随机推荐

  1. Oracle之增、删、改、查

    结构化查询语言 (Structured Query Language, SQL) SQL的组成: 数据操作语言(DML) 对数据进行查询.插入.删除和修改等操作,例如SELECT.INSERT.UPD ...

  2. AWS修改RDS时区

    查看 RDS 当前时区 默认情况下,AWS 的 RDS 采用的是 UTC 时间.而我们地区一般位于东八区,因此我们本地的时间是 UTC+8. 连接到 RDS 上,查询当前实例的时区. show var ...

  3. Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:13,栏位数:12

    Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:13,栏位数:12. 这个报错的原因是在mapper文件中的sql语书写错误 <inse ...

  4. CentOS 7 连接不到网络解决方法(设置静态ip)

    使用VM12创建虚拟机并安装CentOS 7,但是安装完成后发现连接不到网络. ping jd.com发现不通 因为在创建虚拟机的时候 我们选择的是NAT模式 这里给出NAT模式下对应的的解决方法: ...

  5. centos 目录结构

    bin -----存放命令的目录(bin目录是快捷方式)是/usr/bin的快捷方式 sbin ----只有root用户才能使用的命令 etc ----系统服务的配置文件 /usr/local --- ...

  6. CTF-sql-宽字节注入

    本文章主要涉及sql宽字节注入注入的原理讲解,如有错误,望指出.(附有目录,如需查看请点右下角) 一.首先介绍一下本篇文章所用到的知识点: 常用到的url编码: 空格:%20 单引号:%27 在sql ...

  7. 1011day-人口普查系统

    1.Browse.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" ...

  8. 【C++】类-派生和继承

    类-派生和继承 目录 类-派生和继承 1.基本概念 2. 语法 3. 继承方式 4. 类型转换 5. 派生类的构造.析构函数 构造函数 复制构造函数 析构函数 1.基本概念 继承:保持已有类的特性而构 ...

  9. Python webargs 模块

    一.安装 python3 -m pip install webargs 文档 二.基础特性 # encoding=utf-8 from flask import Flask from webargs ...

  10. Hbuilder将移动app或者web项目打包

    1. 直接将项目 npm run build 打包生成dist文件 2.将dist文件放到Hbuilderx或者Hbuilder里面,这个时候你会发现他是w的,需要将其转换为A 点击该dist项目右键 ...