UI控件类

1、UIView   视图 (区别 “根view”和“View Controller”)

 

(1)frame 属性 : CGRect类型

 

(2)bounds 属性 : CGRect 类型 (x,y为空)

 

(3)center 属性 :CGPoint 类型

 

(4)subViews 属性:类型为NSArray ,访问其子控件(可多个)

 

(5)superView 属性:类型为UIView,返回其父控件(唯一)

 

(6)setAnimationDuration  类方法: 设置动画时长

 

(7)beginAnimations:nil   context:nil  类方法:首位式动画,常用nil做参数

 

(8)commitAnimations  类方法:设置动画结束

 

(9)UIView animateWithDuration: (时长) animations:<#^(void)animations#>   类方法:通过代码块方式设置动画

 

(10)UIView animateWithDuration: (时长) animations:<#^(void)animations#>  completion^(bool  finished)      类方法:同上,增加判断上一个动画是否结束

 

(11)tag  属性:给控件做标记

 

(12)addSubView   方法: 将子控件加入控件

 

(13) transform   属性: 类型为CGAffineTransform的结构体,不能和frame混合使用

 

扩充:修改transform的函数

 

  a、只能执行一次的:

 

CGAffineTransformMakeTranslation      水平移动

CGAffineTransformMakeScale            等比例缩放

CGAffineTransformMakeRotation         按角度旋转

 

  b、可以执行多次的:

 

CGAffineTransformTranslate

CGAffineTransformScale

CGAffineTransformRotate

 

  c、恢复初始:

 

CGAffineTransformIdentity

 

(14)setTranslatesAutoresizingMaskIntoConstraints 属性set方法:参数BOOL使得某个view可以不遵从自动布局

 

(15)bringSubViewToFront  方法 : 将某个子控件放到第一层,通过父控件调用

  

(16) clipsToBounds 属性: 根据视图修剪内容或子视图,BOOL类型, layer.maskToBounds 同效

 

(17)- (CGPoint)convertPoint:(CGPoint)point fromView:(nullable UIView *)view  对象方法:(从一个视图)转换坐标系

 

posted @ 2016-03-09 21:21  独孤求傲  阅读(156)  评论(0编辑  收藏  举报