无意进去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
时间: 2024-08-10 17:17:16

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

iOS开发常用三方库、插件、知名博客等等

TimLiu-iOS   Swift版本点击这里 欢迎加入QQ交流群: 594119878 介绍 这是一个用于iOS开发的各种开源库.开源资料.开源技术等等的索引库. github排名 https://github.com/trending,github搜索:https://github.com/search 使用方法 根据目录关键字搜索,记得包含@,以保证搜索目录关键字的唯一性. 问题反馈 期待大家和我们一起共同维护,同时也期望大家随时能提出宝贵的意见(直接提交issues即可).请广大网友只

iOS 强大第三方资源库

Github用法 git-recipesGit recipes in Chinese. 高质量的Git中文教程. lark怎样在Github上面贡献代码 my-git有关 git 的学习资料 gitignore非常赞 有用的.gitignore模板集合(忽略上传的文件集合),包含了各种语言. 完整[email protected] open-source-ios-apps- iOS开源App集合,分:swift与Objective-C--国外人整理. NewsBlur作者独自一个人 Samuel

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

UI 下拉刷新 EGOTableViewPullRefresh- 最早的下拉刷新控件. SVPullToRefresh- 下拉刷新控件. MJRefresh- 仅需一行代码就可以为UITableView或者CollectionView加上下拉刷新或者上拉刷新功能.可以自定义上下拉刷新的文字说明.具体使用看"使用方法". (国人写) XHRefreshControl- XHRefreshControl 是一款高扩展性.低耦合度的下拉刷新.上提加载更多的组件.(国人写) CBStoreHo

iOS开发之资料收集

github排名:https://github.com/trending, github搜索:https://github.com/search. 此文章转自github:https://github.com/Tim9Liu9/TimLiu-iOS UI 下拉刷新 EGOTableViewPullRefresh- 最早的下拉刷新控件. SVPullToRefresh- 下拉刷新控件. MJRefresh- 仅需一行代码就可以为UITableView或者CollectionView加上下拉刷新或者

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

iOS开发非常全的三方库.插件.大牛博客等等 github排名:https://github.com/trending, github搜索:https://github.com/search. 此文章转自github:https://github.com/Tim9Liu9/TimLiu-iOS UI 下拉刷新 EGOTableViewPullRefresh- 最早的下拉刷新控件. SVPullToRefresh- 下拉刷新控件. MJRefresh- 仅需一行代码就可以为UITableView或

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

用到的组件1.通过CocoaPods安装项目名称项目信息 AFNetworking网络请求组件 FMDB本地数据库组件 SDWebImage多个缩略图缓存组件 UICKeyChainStore存放用户账号密码组件 Reachability监测网络状态 DateTools友好化时间 MBProgressHUD一款提示框第三方库 MWPhotoBrowser一款简单的 iOS 照片浏览控件 CTAssetsPickerController一个选择器组件, 支持从用户的相片库选择多张照片和视频. QB

把时间当作朋友——第5章 思考

1.勤于思考 遇到问题动脑子想一想其实是根本不费力气的事情,可偏偏很多人最常说的一句话是"想那么多累不累啊?"这话相当古怪,特别是从一个"人"--作为地球上唯一拥有庞大大脑额叶的物种的成员--的口中说出来. 谁也说不清,为什么会有那么高比例的人懒得思考.不愿思考.害怕思考.厌恶思考--这个比例保守估计不会低于80%,而且,剩下的20%中甚至又有80%常常用错误的方法思考.综合来说,在全人类中能用简单且清楚的方式把问题想明白的人几乎不到4%.这4%的人,绝大多数最终选

Qt for iOS,Qt 与Objective C混合编程

项目设置 既然要聊 Qt 混合 OC 编程,首先要简单介绍一下 Objective C .我只有一句话:Go,问搜索引擎去.因为我所知实在有限,怕误导了您.当然如果您不怕,往下看吧. OC源文件介绍 首先我要说一下 Objective C 的源文件,后缀是.m 或 .mm ,在 .mm 文件里,可以直接使用 C++ 代码.所以,我们要混合 Qt 代码与 OC 代码,就需要在 Qt 项目里加入 mm 文件. pro 文件配置 Qt SDK for Mac ,安装之后, Qt Creator 会使用

黄山三日行

20160520-20160522 5月20号我们坐上去黄山的汽车,并没有很期待什么,只是因为对于独自在外的我来说,长假一个人会很漫长,所以希望玩的时候可以让时间过的快点.当天下午两天多到黄山脚下的时候,只看见眼前的云雾和随处跟着我们的拉客的人,每个人都很热情,但因为我们听多了外面被骗的事情,所以一直不敢相信带我们去某个酒店的任何人.我们最终还是找了家连锁店.从早上出门到现在大家还没吃过饭,就在外面随便吃了点回去玩扑克了.同行的人都是相互之间有着很好的关系,或许因为这样,我们玩的很开心.晚上又冒