UIKit继承结构和UIView.h文件详解

@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
UIKit继承结构和UIView.h文件详解的更多相关文章
- CGGeometry.h 文件详解
这些是在CGGeometry.h里的 CGPoint.CGSize.CGRect.CGRectEdge实际上都是结构体 struct CGPoint { CGFloat x; CGFloat y; } ...
- UIView常用属性与方法/UIKit继承结构
UIView常用属性与方法 @interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDy ...
- jni.h头文件详解二
作者:左少华 博客:http://blog.csdn.net/shaohuazuo/article/details/42932813 转载请注明出处:http://blog.csdn.net/shao ...
- 【转】 jni.h头文件详解(二)
原文网址:http://blog.csdn.net/shaohuazuo/article/details/42932813 作者:左少华 博客:http://blog.csdn.net/shaohua ...
- [转]AndroidManifest.xml文件详解
转自:http://www.cnblogs.com/greatverve/archive/2012/05/08/AndroidManifest-xml.html AndroidManifest.xml ...
- 【好程序员笔记分享】——UIView与CALayer详解
-iOS培训,iOS学习-------型技术博客.期待与您交流!------------ UIView与CALayer详解 研究Core Animation已经有段时间了,关于Core Animati ...
- PE文件详解(六)
这篇文章转载自小甲鱼的PE文件详解系列原文传送门 之前简单提了一下节表和数据目录表,那么他们有什么区别? 其实这些东西都是人为规定的,一个数据在文件中或者在内存中的位置基本是固定的,通过数据目录表进行 ...
- Maven pom.xml文件详解
Maven pom.xml文件详解 一.简介 POM全称是Project Object Model,即项目对象模型. pom.xml是maven的项目描述文件,它类似与antx的project.xml ...
- 史上最全的maven的pom.xml文件详解(转载)
此文出处:史上最全的maven的pom.xml文件详解——阿豪聊干货 <project xmlns="http://maven.apache.org/POM/4.0.0" x ...
随机推荐
- Struts2的通配符配置方式
Struts2的Action类很有意思,你可以使用3种方式来实现具体的Action类: 让你的Action类继承自ActionSupport类(项目中最常用这种方式,因为ActionSupport类中 ...
- 【转】delphi 保存到txt文件
procedure TForm1.btn1Click(Sender: TObject); var astr: string; sList: TStrings; path: string; begin ...
- java实现的简单词法分析器
一个简单的词法分析器 词法分析(Lexical Analysis) 是编译的第一阶段.词法分析器的主要任务是读入源程序的输入字符.将他们组成词素,生成并输出一个词法单元序列,每个词法单元对应一个词素. ...
- MSSQL2008 中文乱码问题 (引自ljg888的专栏)
PHP向MSSQL2008中写入数据,中文乱码 首先:查看SQLserver编码格式的SQL语句为: SELECT COLLATIONPROPERTY('Chinese_PRC_Stro ...
- oracle数据库 参数open_cursors和session_cached_cursor详解!
open_cursors 每个session(会话)最多能同时打开多少个cursor(游标) session_cached_cursor 每个session(会话)最多可以缓存多少个关闭掉的curso ...
- Blob写入文件
1.Spring自带方法,定义输出流就可以写入文件 final OutputStream os; os = new FileOutputStream(new File("300.zip&qu ...
- EditText文本中用正则匹配是否包含数字,及判断文本只能是纯汉字或纯字母
遇到判断EditText中文本,是否为制定格式 EditText et; Button btn; @Override protected void onCreate(Bundle savedInsta ...
- 非常不错的MySQL优化的8条经验
1.选取最适用的字段属性 MySQL 可以很好的支持大数据量的存取,但是一般说来,数据库中的表越小,在它上面执行的查询也就会越快.因此,在创建表的时候,为了获得更好的性能,我们可以将表中字段的宽度 ...
- 线段树解决leetcode307. Range Sum Query - Mutable
在下面的图中,求[0,0]和[1,1]区间元素和, 对于[0,0] start =0 ,end = 0, 查到root = 4 [0-1]的节点,mid = 0, 此时mid > end-1,表 ...
- 成为java高手的八大条件
1.扎实的基础 数据结构.离散数学.编译原理,这些是所有计算机科学的基础,如果不掌握它们,很难写出高水平的程序.程序人人都会写,但当你发现写到一定程度很难再提高 的时候,就应该想想是不是要回过头来学 ...