无意进去UIView随笔闹腾着玩 -by 胡 xu
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的更多相关文章
- iOS的非常全的三方库,插件,大牛博客
转自: http://www.cnblogs.com/zyjzyj/p/6015625.html github排名:https://github.com/trending, github搜索:http ...
- iOS开发之资料收集
github排名:https://github.com/trending, github搜索:https://github.com/search. 此文章转自github:https://github ...
- iOS 第三方库、插件、知名博客总结
iOS 第三方库.插件.知名博客总结 用到的组件 1.通过CocoaPods安装 项目名称 项目信息 AFNetworking 网络请求组件 FMDB 本地数据库组件 SDWebImage 多个缩略图 ...
- iOS -- 开源项目和库
TimLiu-iOS 目录 UI 下拉刷新 模糊效果 AutoLayout 富文本 图表 表相关与Tabbar 隐藏与显示 HUD与Toast 对话框 其他UI 动画 侧滑与右滑返回手势 gif动画 ...
- iOS非常全的第三方库
iOS ● 非常全的三方库.插件.大牛博客等等 github排名:https://github.com/trending, github搜索:https://github.com/search. ...
- ios很好的开源库
Tim9Liu9/TimLiu-iOS 自己总结的iOS.mac开源项目及库,持续更新.. 目录 UI 下拉刷新 模糊效果 AutoLayout 富文本 图表 表相关与Tabbar 隐藏与显示 HUD ...
- iOS开发 非常全的三方库、插件、大牛博客等等
UI 下拉刷新 EGOTableViewPullRefresh- 最早的下拉刷新控件. SVPullToRefresh- 下拉刷新控件. MJRefresh- 仅需一行代码就可以为UITableVie ...
- WMPlayer
WMPlayer视频播放器,AVPlayer的封装,继承UIView,想怎么玩就怎么玩.支持播放mp4.m3u8.3gp.mov,网络和本地视频同时支持.全屏和小屏播放同时支持.自动感应旋转屏幕. 1 ...
- iOS:iOS开发非常全的三方库、插件等等
iOS开发非常全的三方库.插件等等 github排名:https://github.com/trending, github搜索:https://github.com/search. 此文章转自git ...
随机推荐
- Java高级程序设计笔记 • 【第3章 多线程(二)】
全部章节 >>>> 本章目录 3.1 同步代码块 3.1 线程安全 3.1.1 模拟银行取款 3.1.2 同步代码块的使用 3.1.3 实践练习 3.2 同步方法 3.2. ...
- 抛弃go-micro,使用极简微服务框架Bull
简介 Bull是一款基于GO语言的极简微服务框架. 使用GRPC作为RPC协议,使用ETCD作为注册中心. 框架目前已经实现了服务注册.服务发现(客户端轮训)功能. 整体架构 代码地址 https:/ ...
- SpringBoot 原理分析、监控、项目部署
目录 SpringBoot 监控 概述 使用 SpringBoot Admin 概述 使用 SpringBoot 项目部署 SpringBoot 监控 概述 SpringBoot 自带监控功能 Act ...
- windows 找不到文件gpedit.msc
前言: 最新在装一个软件的时候,需要更改本地组的一些内容,win+R输入gpedit.msc,提示找不到文件. 解决: 第一种方法:笔者电脑是window10 家庭版,试了网上新建一个txt文件,写入 ...
- java如何对接企业微信
前言 最近实现社群对接企业微信,对接的过程遇到一些点,在此记录. 企业微信介绍 企业微信具有和微信一样的体验,用于企业内部成员和外部客户的管理,可以由此构建出社群生态. 企业微信提供了丰富的api进行 ...
- xray 与 awvs 爬虫联动
awvs 的爬虫很好用,支持表单分析和单页应用的爬取,xray 的扫描能力比较强,速度也更快.awvs 和 xray 搭配使用则是如虎添翼.这里演示的是扫描 awvs 的在线靶站 http://tes ...
- k8s中的nginx-ingress如何配置路径重定向
k8s中的nginx-ingress如何配置路径重定向 一. 需求描述 路径重定向的一般应用场景: 调整用户浏览的URL,看起来更规范 为了让搜索引擎收录网站内容,让用户体验更好 网站更换新域名后 根 ...
- GeoServer介绍
GeoServer本质上是一个地图服务器,它是遵循OpenGIS Web 服务器规范的J2EE实现,通过它可以方便的将地图数据发布为地图服务,实现地理空间数据在用户之间的共享.另外,它也提供了相应的接 ...
- 龙芯 3A4000 安装 Debian10 (via debootstrap)
由于一些原因,Debian 的内核不能直接在龙芯的 cpu 上使用.据悉 Linux 5.7 kernel 改进了对龙芯的支持,不久的将来我们应该就能更愉快地在龙芯上运行 Debian 了. 感谢龙芯 ...
- selenium获取cookies并持久化登陆
selenium获取cookies并持久化登陆 需求背景: 这几天需要写一个接口,用来批量上传数据,最开始考虑的是 UI 自动化,然后选值的时候自动化难以判别,最终选择 接口 自动化. 然后操 ...