UIkit框架之Uivew

时间:2022-09-27 22:15:33

1.继承链:UIresponder:NSObject

2.通过使用 addGestureRecognizer:方法可以为视图添加手势

3.下面的属性都可以用来用于动画

4.子视图一般用来进行覆盖的方法:

    (1)initWithFrame:一般用来初始化一个UI控件,位置和大小

    (2)initWithCoder:使用这个方法来载入你的nib file文件到interface builder中

    (3)layerClass:不知道怎么翻译 Implement this method only if you want your view to use a different Core Animation layer for its backing store.

    (4)drawRect:一般用来绘制你的自定义视图内容

    (5)drawRect:forViewPrintFormatter:当你想在你的自定义视图中定义不同的视图内容可以重载这个方法

    (6)requiresConstraintBasedLayout:如果你想要正确的约束你的视图可以使用这个方法

    (7)updateConstraints:如果你的视图和你的子视图要创建有一个自定义约束可以使用这个方法,应该是用来更新约束的把

    (8)alignmentRectForFrame:frameForAlignmentRect:实现让你的视图如何和其他视图对齐

    (9)sizeThatFits: - Implement this method if you want your view to have a different default size than it normally would during resizing operations.

    (10)layoutSubviews:使用这个方法来使你的视图更加精确的布局而不使用那些约束

    (11)didAddSubview:willRemoveSubview:可以用来更加或者删除一些视图

    (12)willMoveToSuperview:didMoveToSuperview - Implement these methods as needed to track the movement of the current view in your view hierarchy.

    (13)willMoveToWindow:didMoveToWindow - Implement these methods as needed to track the movement of your view to a different window.

    (14)touchesBegan:withEvent:touchesMoved:withEvent:touchesEnded:withEvent:touchesCancelled:withEvent:当发生触碰事件的时候可以使用这些方法

    (15)gestureRecognizerShouldBegin:发生触碰时间或者其他的手势时间的时候可以使用这个方法

5.UIview的方法大全:

/** 获取到事件中点击的视图用来判断当前点击 */

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{

/** 获取事件event中的触发视图*/

UIView *hitView = [superhitTest:point withEvent:event];

/** 判断是否当前视图 */

if (hitView ==self) {

returnnil;

} else {

return hitView;

}

}

/** 判断是否是当前视图触发的事件 */

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{

return [superpointInside:point withEvent:event];

}

/** 将一个坐标点转换成指定view的坐标 */

- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view{

return [superconvertPoint:point toView:view];

}

/** 将一个坐标点转换成当前view的坐标 */

- (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view{

return [superconvertPoint:point fromView:view];

}

/** 将一个CGRect转换成指定view的CGRect */

- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view{

return [superconvertRect:rect toView:view];

}

/** 讲一个CGRect转换成当前view的CGRect */

- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view{

return [superconvertRect:rect fromView:view];

}

/** 获取适合label内容的CGSize */

- (CGSize)sizeThatFits:(CGSize)size{

return [supersizeThatFits:size];

}

/** 自动设置适合内容的CGSize */

- (void)sizeToFit{

[supersizeToFit];

}

/** 从父视图中移除当前视图 */

- (void)removeFromSuperview{

[superremoveFromSuperview];

}

/** 在index层插入一个视图 */

- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index{

[superinsertSubview:view atIndex:index];

}

/** 交换两个视图的图层 */

- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2{

[superexchangeSubviewAtIndex:index1 withSubviewAtIndex:index2];

}

/** 加入一个视图在最上一层 */

- (void)addSubview:(UIView *)view{

[superaddSubview:view];

}

/** 在siblingSubview视图下面插入一个视图 */

- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview{

[superinsertSubview:view belowSubview:siblingSubview];

}

/** 在siblingSubview视图上面插入一个视图 */

- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview{

[superinsertSubview:view aboveSubview:siblingSubview];

}

/** 将一个视图放到最上一层 */

- (void)bringSubviewToFront:(UIView *)view{

[superbringSubviewToFront:view];

}

/** 将一个视图推送到最下层 */

- (void)sendSubviewToBack:(UIView *)view{

[supersendSubviewToBack:view];

}

/** 添加子视图时调用 */

- (void)didAddSubview:(UIView *)subview;{

[superdidAddSubview:subview];

NSLog(@"添加子视图");

}

/** 将要移除子视图时调用 */

- (void)willRemoveSubview:(UIView *)subview{

[superwillRemoveSubview:subview];

NSLog(@"移除子视图");

}

/** 父视图将要发生更改时调用 */

- (void)willMoveToSuperview:(UIView *)newSuperview{

[superwillMoveToSuperview:newSuperview];

NSLog(@"父视图将要发生更改");

}

/** 父视图更改时调用 */

- (void)didMoveToSuperview{

[superdidMoveToSuperview];

NSLog(@"父视图发生更改");

}

/** 视图或其超视图将要展示到窗口调用 */

- (void)willMoveToWindow:(UIWindow *)newWindow{

[superwillMoveToWindow:newWindow];

NSLog(@"视图展示到窗口");

}

/** 视图或其超视图展示到窗口调用 */

- (void)didMoveToWindow{

[superdidMoveToSuperview];

NSLog(@"视图或其超视图展示到窗口");

}

/** 判断当前视图是否是指定视图或者其子视图 */

- (BOOL)isDescendantOfView:(UIView *)view{

return [superisDescendantOfView:view];

}

/** 获取当前视图内指定tag值的视图 */

- (UIView *)viewWithTag:(NSInteger)tag{

return [superviewWithTag:tag];

}

/** 在图层绘制时调用的方法 */

- (void)setNeedsLayout{

}

- (void)layoutIfNeeded{

}

/** 当视图上的图层发生改变时调用 */

- (void)layoutSubviews{

}

/** 发生自动布局时调用 */

- (void)layoutMarginsDidChange{

}

/** 绘制图层layer时调用 */

- (void)drawRect:(CGRect)rect{

}

/** 重绘图层 */

- (void)setNeedsDisplay{

}

/** 重绘图层指定范围 */

- (void)setNeedsDisplayInRect:(CGRect)rect{

}

/** tintColor 是一种有抛光效果的设置视图颜色 */

/** tintColor改变时调用 */

- (void)tintColorDidChange{

}

#pragma mark - 动画相关

/** 开启动画块 animationID动画标示 context参数 */

+ (void)beginAnimations:(NSString *)animationID context:(void *)context{

[superbeginAnimations:animationID context:context];

}

/** 提交动画块动画开始执行 */

+ (void)commitAnimations{

[supercommitAnimations];

}

/** 设置动画代理 */

+ (void)setAnimationDelegate:(id)delegate{

[supersetAnimationDelegate:delegate];

}

/** 当动画开始时发送一个消息给动画代理 */

+ (void)setAnimationWillStartSelector:(SEL)selector{

[supersetAnimationWillStartSelector:selector];

/** 动画代理执行selector方法 */

}

/** 当动画结束时发送一个消息给动画代理 */

+ (void)setAnimationDidStopSelector:(SEL)selector{

[supersetAnimationDidStopSelector:selector];

/** 动画代理执行selector方法 */

}

/** 设置动画时长默认0.2s */

+ (void)setAnimationDuration:(NSTimeInterval)duration{

[supersetAnimationDuration:duration];

}

/** 设置动画执行延迟时长默认0s */

+ (void)setAnimationDelay:(NSTimeInterval)delay{

[supersetAnimationDelay:delay];

}

/** 设置动画开始时间NSDate */

+ (void)setAnimationStartDate:(NSDate *)startDate{

[supersetAnimationStartDate:startDate];

}

/** 设置动画的曲线方式(就是动画的总体变化的时间曲线:开始快最后慢,开始慢最后快,最后慢,均匀线性)。

curve参数如下:

typedef NS_ENUM(NSInteger, UIViewAnimationCurve) {

UIViewAnimationCurveEaseInOut,         // slow at beginning and end

UIViewAnimationCurveEaseIn,            // slow at beginning

UIViewAnimationCurveEaseOut,           // slow at end

UIViewAnimationCurveLinear

};

*/

+ (void)setAnimationCurve:(UIViewAnimationCurve)curve{

[supersetAnimationCurve:curve];

}

/** 设置动画重复次数 */

+ (void)setAnimationRepeatCount:(float)repeatCount{

[supersetAnimationRepeatCount:repeatCount];

}

/**

设置动画是否做一次反向的执行。

如果设置为YES:动画将执行:动画初始状态》动画》动画完成状态》动画》动画初始状态。

如果设置为NO:默认值

*/

+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses{

[supersetAnimationRepeatAutoreverses:repeatAutoreverses];

}

/** 设置动画开始时状态

当YES时:当上一次动画正在执行中,那么当下一个动画开始时,上一次动画的当前状态将成为下一次动画的开始状态。

当NO时:当上一个动画正在执行中,那么当下一个动画开始时,上一次动画需要先恢复到完成时的状态,然后在开始执行下一次动画。

*/

+ (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState{

}

/** 添加动画到视图view上 transition动画样式 cache为YES时高效 但动画执行过程中不能更新UI为NO时每一帧都可以重新绘制 可以实时更新UI */

+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView*)view cache:(BOOL)cache{

}

/** 是否支持动画默认YES */

+ (void)setAnimationsEnabled:(BOOL)enabled{

}

/** 返回动画效果是否被禁用 */

+ (BOOL)areAnimationsEnabled{

return [superareAnimationsEnabled];

}

/** 强制一些动作不使用动画我也不懂 测出来再补上 */

+ (void)performWithoutAnimation:(void (^)(void))actionsWithoutAnimation{

}

#pragma mark - 动画Block块

/**

duration   执行时长

delay      延迟时长

options    动画执行曲线

animations 动画动作Block

completion 动画执行完毕后执行的Block

*/

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion {

}

/**

duration   执行时长

animations 动画动作Block

completion 动画执行完毕后执行的Block

*/

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion {

}

/**

duration   执行时长

animations 动画动作Block

*/

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations {

}

/**

SpringAnimation动画干净 快速

usingSpringWithDamping 0~1 弹簧效果越小弹簧效果越明显

initialSpringVelocity  初始速度初始速度取值较高而时间较短时 也会出现弹簧效果

*/

+ (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 {

}

/**

过场动画

duration   动画时长

view       进行转场动画的视图

options    专场动画类型

animations 执行动画

completion 动画结束后调用的Block

*/

+ (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void(^)(BOOL finished))completion {

}

/**

过场动画

[fromView.superview addSubview:toView];

[fromView.superview removeFromSuperview];

*/

+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion {

}

/**

在一组视图上执行指定的系统动画,并可以并行自定义的动画

parallelAnimations就是与系统动画并行的自定义动画

*/

+ (void)performSystemAnimation:(UISystemAnimation)animation onViews:(NSArray *)views options:(UIViewAnimationOptions)options animations:(void (^)(void))parallelAnimations completion:(void (^)(BOOL finished))completion {

}

#pragma mark - UIViewKeyframeAnimations

/**

关键帧动画

duration   动画时长

delay      动画延迟

options    动画效果选项

animations 动画执行代码

completion 动画结束执行代码

*/

+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewKeyframeAnimationOptions)options animations:(void(^)(void))animations completion:(void (^)(BOOL finished))completion {

}

/**

frameStartTime 动画相对开始时间

frameDuration  动画相对持续时间

自身会根据动画总持续时长自动匹配其运行时长

*/

+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime relativeDuration:(double)frameDuration animations:(void (^)(void))animations {

}

#pragma mark - 手势

/** 添加手势 */

- (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer {

}

/** 移除手势 */

- (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer {

}

/** 是否执行该手势 */

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {

returnYES;

}

/** 添加运动拟真效果 */

/** UIMotionEffect 运动拟真效果类物理效果 */

- (void)addMotionEffect:(UIMotionEffect *)effect {

}

/** 移除运动拟真效果 */

- (void)removeMotionEffect:(UIMotionEffect *)effect {

}

#pragma mark - 约束自动布局

/** 只知道是自动布局相关但是具体效果 未知查不到 测不出==! */

- (NSArray *)constraints {

return [superconstraints];

}

/** 添加约束需要先开启自动布局 */

- (void)addConstraint:(NSLayoutConstraint *)constraint {

}

/** 添加约束 */

- (void)addConstraints:(NSArray *)constraints {

}

/** 移除约束 */

- (void)removeConstraint:(NSLayoutConstraint *)constraint {

}

/** 移除约束 */

- (void)removeConstraints:(NSArray *)constraints {

}

/** 更新视图和其子视图的约束 */

- (void)updateConstraintsIfNeeded {

}

/** 更新视图和其子视图的约束 */

- (void)updateConstraints {

}

/** 是否更新视图的约束 */

- (BOOL)needsUpdateConstraints {

return [superneedsUpdateConstraints];

}

/** 设置视图的约束需要更新 */

- (void)setNeedsUpdateConstraints {

}

/** 是否关闭自动布局 */

- (BOOL)translatesAutoresizingMaskIntoConstraints {

return [supertranslatesAutoresizingMaskIntoConstraints];

}

/** 是否关闭自动布局 */

- (void)setTranslatesAutoresizingMaskIntoConstraints:(BOOL)flag {

}

/** 是否支持自动布局 */

+ (BOOL)requiresConstraintBasedLayout {

return [superrequiresConstraintBasedLayout];

}

/** 返回给定框架的视图的对齐矩阵 */

- (CGRect)alignmentRectForFrame:(CGRect)frame {

return [superalignmentRectForFrame:frame];

}

/** 返回给定对齐矩形的视图的frame  */

- (CGRect)frameForAlignmentRect:(CGRect)alignmentRect {

return [superframeForAlignmentRect:alignmentRect];

}

/** 对当前View设置用来布局的矩形设置偏移 */

- (UIEdgeInsets)alignmentRectInsets {

return [superalignmentRectInsets];

}

/** 默认返回当前视图的底部作为baseline。我们可以重写上述方法,但必须返回的是当前视图中的子视图 */

- (UIView *)viewForBaselineLayout {

return [superviewForBaselineLayout];

}

/** 通过重写intrinsicContentSize可以设置当前视图显示特定内容时的大小 */

- (CGSize)intrinsicContentSize {

CGSize size = [superintrinsicContentSize];

if (self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact) {

size.width +=4.0f;

} else {

size.width +=40.0f;

}

if (self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact) {

size.height +=4.0;

} else {

size.height +=40.0;

}

return size;

}

/** 视图根据内部内容设置Size */

- (void)invalidateIntrinsicContentSize {

[superinvalidateIntrinsicContentSize];

}

- (UILayoutPriority)contentHuggingPriorityForAxis:(UILayoutConstraintAxis)axis {

return [supercontentHuggingPriorityForAxis:axis];

}

/** 使其在“内容大小”的基础上不能继续变大 */

- (void)setContentHuggingPriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis {

}

- (UILayoutPriority)contentCompressionResistancePriorityForAxis:(UILayoutConstraintAxis)axis {

return [supercontentCompressionResistancePriorityForAxis:axis];

}

/** 使其在在其“内容大小”的基础上不能继续变小 */

- (void)setContentCompressionResistancePriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis {

}

/** 动态计算控件的Size targetSize可传参数:UILayoutFittingCompressedSize最小情况下可能的Size UILayoutFittingExpandedSize最大情况下可能的Size */

- (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize {

return [supersystemLayoutSizeFittingSize:targetSize];

}

/** 动态计算控件的Size UILayoutPriority优先级

horizontalFittingPriority   水平约束优先级

verticalFittingPriority     垂直约束优先级 */

- (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize withHorizontalFittingPriority:(UILayoutPriority)horizontalFittingPriority verticalFittingPriority:(UILayoutPriority)verticalFittingPriority {

return[supersystemLayoutSizeFittingSize:targetSizewithHorizontalFittingPriority:horizontalFittingPriorityverticalFittingPriority:verticalFittingPriority];

}

/** 约束检查为什么这个View 这样显返回值 约束条件 */

- (NSArray *)constraintsAffectingLayoutForAxis:(UILayoutConstraintAxis)axis {

return [superconstraintsAffectingLayoutForAxis:axis];

}

/** 判断当前的自动布局约束是否还有其他满足约束的条件 */

- (BOOL)hasAmbiguousLayout {

return [superhasAmbiguousLayout];

}

/** 随机实现一个满足约束的条件 */

- (void)exerciseAmbiguityInLayout {

}

#pragma mark - NSCoder

/** 归档时编码 */

- (void) encodeRestorableStateWithCoder:(NSCoder *)coder {

}

/** 反归档时解码 */

- (void) decodeRestorableStateWithCoder:(NSCoder *)coder {

}

/** 复制一个复合视图

afterUpdates    是否视图展示时才生成视图

No              会立即生成快照,并不会调用重新设置颜色的方法无色

YES             当调用这个视图时生成

*/

- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates {

return [supersnapshotViewAfterScreenUpdates:afterUpdates];

}

/** 复制一个指定范围偏移量的复合视图 */

- (UIView *)resizableSnapshotViewFromRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates withCapInsets:(UIEdgeInsets)capInsets {

return[superresizableSnapshotViewFromRect:rectafterScreenUpdates:YESwithCapInsets:capInsets];

}

/** 将指定范围的视图绘制到图形上下文中 */

- (BOOL)drawViewHierarchyInRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates {

return [superdrawViewHierarchyInRect:rect afterScreenUpdates:afterUpdates];

}

6.UIview的属性:

    (1)backgroundColor

    (2)hidden:布尔类型,是否隐藏视图

     (3)alpha:cgfloat类型,设置视图的透明度,0.0-1.0

    (4)opaque:布尔类型,是否为不透明

    (5)clipsToBounds,布尔类型,是否限制子视图只能在视图中显示

    (6)clearsContextBeforeDrawing:布尔类型,是否在绘制之前自动清除界限bounds

    (7)maskView:uiview类型,通过这个视图的透明度来遮盖另一个视图的内容

    (8)+ (Class)layerClass:可以通过这个方法返回一个不同类型的视图图层

7.和事件接触有关的行为:

    (1)userInteractionEnabled:布尔类型,是否允许用户和视图进行交互

    (2)multipleTouchEnabled:布尔类型,是否允许视图能够响应多重接触事件

    (3)exclusiveTouch:布尔类型,是否让接受者唯一的响应接触事件

    (4)- (BOOL)isDescendantOfView:(UIView *)view:返回一个布尔类型,确认这个视图是否是一个视图的子视图

    (5)@property(nonatomic) UIViewAutoresizingautoresizingMask,当父视图的边界改变的时候子视图也得重新调整大小

    (6)@property(nonatomic) BOOL autoresizesSubviews:是否允许子视图边界自动调整

    (7)@property(nonatomic) UIViewContentModecontentMode:当边界改变时该使用哪种方式调整内容

    (8) - (void)sizeToFit:视图的大小随视图内容的改变而调整

    (9)setNeedsLayout:消除旧的视图布局,下一个更新循环到来的时候更新视图布局

    (10)- (void)layoutIfNeeded:快速进行自动布局子视图

    (11) + (BOOL)requiresConstraintBasedLayout:布尔类型,指定接收者是否以约束为基础添加系统的布局,就是说如果你的约束不完整可以使用这个来补全

    (12)@property(nonatomic) BOOL translatesAutoresizingMaskIntoConstraints如果为yes,系统就会创建一系列的约束If this property’s value is YES, the system creates a set of constraints that duplicate the behavior specified by the view’s autoresizing mask.

  8.只读属性:

    (1)@property(readonly, strong) NSLayoutYAxisAnchor*bottomAnchor:Use this anchor to create constraints with the view’s bottom edge. You can combine this anchor only with other NSLayoutYAxisAnchor anchors. For more information, see NSLayoutAnchor Class Reference.

    (2)@property(readonly, strong) NSLayoutXAxisAnchor*centerXAnchor:可以使用这个锚点创建视图水平中心的约束

    (3)@property(readonly, strong) NSLayoutYAxisAnchor*centerYAnchor:可以使用这个锚点创建垂直中心的约束

    (4)@property(readonly, strong) NSLayoutYAxisAnchor*firstBaselineAnchor:For views with multiple lines of text, this anchor represents the baseline of the top row of text. Use this anchor to create constraints with this baseline.

    (5)@property(readonly, strong) NSLayoutDimension*heightAnchor:可以使用这个锚点创建视图高度的约束

    (6)@property(readonly, strong) NSLayoutYAxisAnchor*lastBaselineAnchor:For views with multiple lines of text, this anchor represents the baseline of the bottom row of text. Use this anchor to create constraints with this baseline

    (7)@property(readonly, strong) NSLayoutXAxisAnchor*leadingAnchor可以使用这个锚点创建对齐边缘

    (8)@property(readonly, strong) NSLayoutXAxisAnchor*leftAnchor:可以使用这个锚点创建左边缘的约束

    (9)@property(readonly, strong) NSLayoutXAxisAnchor*rightAnchor:创建右边缘的约束

    (10)@property(readonly, strong) NSLayoutYAxisAnchor*topAnchor:创建顶边缘的约束

    (11)@property(readonly, strong) NSLayoutXAxisAnchor*trailingAnchor:创建视图尾部的约束

    (12)@property(readonly, strong) NSLayoutDimension*widthAnchor:创建视图宽度的约束

    

9.管理视图的约束:

    (1)@property(nonatomic, readonly) NSArray<__kindof NSLayoutConstraint *> *constraints:读取视图的约束

    (2)- (void)addConstraint:(NSLayoutConstraint *)constraint:为视图或者子视图添加一个约束

    (3)- (void)addConstraints:(NSArray<__kindofNSLayoutConstraint *> *)constraints:为视图或者子视图添加约束组

    (4)- (void)removeConstraint:(NSLayoutConstraint *)constraint:删除约束

    (5)- (void)removeConstraints:(NSArray<__kindofNSLayoutConstraint *> *)constraints删除约束组

  10.使用布局指引

    (1)- (void)addLayoutGuide:(UILayoutGuide *)layoutGuide添加布局指引

    (2)@property(nonatomic, readonly, copy) NSArray<__kindof UILayoutGuide *> *layoutGuides:这个视图的布局指引数组,只读

    (3)@property(readonly, strong) UILayoutGuide*layoutMarginsGuide:为视图边缘添加一个边缘约束,只读

    (4)@property(nonatomic, readonly, strong) UILayoutGuide*readableContentGuide:一个可读区域的宽

    (5)- (void)removeLayoutGuide:(UILayoutGuide *)layoutGuide:删除布局指引

 11.自动布局:

    (1)- (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize:参考该视图所有的约束和子视图来决定最好的大小

    (2)- (void)invalidateIntrinsicContentSize:Invalidates the view’s intrinsic content size.

    (3)- (UILayoutPriority)contentCompressionResistancePriorityForAxis:(UILayoutConstraintAxis)axis: 

The constraint-based layout system uses these priorities when determining the best layout for views that are encountering constraints that would require them to be smaller than their intrinsic size.

    (4)- (void)setContentHuggingPriority:(UILayoutPriority)priority
                          forAxis:(UILayoutConstraintAxis)axis   : Sets the priority with which a view resists being made larger than its intrinsic size.

 12.自动布局对齐视图:

    (1)- (CGRect)alignmentRectForFrame:(CGRect)frame: Returns the view’s alignment rectangle for a given frame.

     (2)- (CGRect)frameForAlignmentRect:(CGRect)alignmentRect : Returns the view’s frame for a given alignment rectangle
    (3)- (UIEdgeInsets)alignmentRectInsets : Returns the insets from the view’s frame that define its alignment rectangle.
    (4)@property(readonly, strong) UIView*viewForFirstBaselineLayout : 返回一个视图用来满足第一个基线约束
    (5)@property(readonly, strong) UIView*viewForLastBaselineLayout:返回一个视图用来满足最后的基线约束。

13.触发自动约束

    (1)- (BOOL)needsUpdateConstraints :布尔值类型,决定是否需要要更新视图的约束

    (2)- (void)setNeedsUpdateConstraints : 方法,控制视图约束是否需要更新

    (3)- (void)updateConstraints :为视图更新约束

    (4)- (void)updateConstraintsIfNeeded : 无论布局什么时候被触发,系统会调用这个方法来更新当前视图的约束

14.调试自动布局

    (1)- (BOOL)hasAmbiguousLayout  : yes的话就不完全指定视图的位置

    (2)- (void)exerciseAmbiguityInLayout : 这个方法随机的改变视图的frame通过一个不确定的值

    (3)@property(nonatomic) UISemanticContentAttributesemanticContentAttribute : 通常用来决定视图是否能够快速滑动

    (4)+ (UIUserInterfaceLayoutDirection)userInterfaceLayoutDirectionForSemanticContentAttribute:(UISemanticContentAttribute)attribute : 当视图有子视图的时候可以使用这个方法来决定子视图是否需要快速翻动

15.配置内容边缘

    (1)@property(nonatomic) UIEdgeInsetslayoutMargins :Use this property to specify the desired amount of space (measured in points) between the edge of the view and any subviews. Auto layout uses your margins as a cue for placing content

    (2)@property(nonatomic) BOOL preservesSuperviewLayoutMargins : 当这个属性的值为yes 的时候,进行布局的时候也需要考虑到父视图的边缘

    (3)- (void)layoutMarginsDidChange : 通知视图布局边缘发生了改变

16.绘制和更新视图

    (1)- (void)drawRect:(CGRect)rect : 当你想绘制自己的视图内容时应该重载这个方法‘

    (2)- (void)setNeedsDisplay : 当你的视图内容需要重画的时候可以重载这个方法,但是这个方法不会立即更新,只有在下一轮的循环到来的时候也就是旧的点不再用的时候才会更新

    (3)- (void)setNeedsDisplayInRect:(CGRect)invalidRect : 为接受者指定的矩形区域进行重画,当你的视图内容有某一部分需要重画的时候可以重载这个方法

    (4)@property(nonatomic) CGFloatcontentScaleFactor :就是用这个属性来改变视图的大小,例如视图为50*50  , 这个属性值为2.0 , 最后得到的视图为100*100

    (5)- (void)tintColorDidChange :当tintcolor属性发生改变的时候就会触发这个方法

17.格式的打印视图内容

    (1)- (UIViewPrintFormatter *)viewPrintFormatter : 当初始化一个打印任务时,可以为你的视图调用这个方法获取合适的视图打印格式 

    (2)- (void)drawRect:(CGRect)area
forViewPrintFormatter:(UIViewPrintFormatter *)formatter   : 如果你想要一个视图的印刷内容出现不同于其显示内容可以使用这个方法

18.管理手势识别器

    (1)- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer : 为视图添加一个手势识别器

    (2)- (void)removeGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer : 从视图中移除有一个手势识别器

    (3)@property(nonatomic, copy) NSArray<__kindof UIGestureRecognizer *> *gestureRecognizers : 当前在视图中的视图识别器组成的数组

    (4)- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer :如果为yes的时候该手势就应该一直跟踪接触事件

19.动画视图和块对象

    (1)+ (void)animateWithDuration:(NSTimeInterval)duration
                      delay:(NSTimeInterval)delay
                    options:(UIViewAnimationOptions)options
                 animations:(void (^)(void))animations
                 completion:(void (^)(BOOL finished))completion   

duration

The total duration of the animations, measured in seconds. If you specify a negative value or 0, the changes are made without animating them.

delay

The amount of time (measured in seconds) to wait before beginning the animations. Specify a value of 0 to begin the animations immediately.

options

A mask of options indicating how you want to perform the animations. For a list of valid constants, see UIViewAnimationOptions.

animations

A block object containing the changes to commit to the views. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be NULL.

completion

A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL.

 这个方法是用来初始化一个完整动画的
    (2)+ (void)animateWithDuration:(NSTimeInterval)duration
                 animations:(void (^)(void))animations
                 completion:(void (^)(BOOL finished))completion
duration

The total duration of the animations, measured in seconds. If you specify a negative value or 0, the changes are made without animating them.

animations

A block object containing the changes to commit to the views. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be NULL.

completion

A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL.

    (3)+ (void)animateWithDuration:(NSTimeInterval)duration
                 animations:(void (^)(void))animations
duration

The total duration of the animations, measured in seconds. If you specify a negative value or 0, the changes are made without animating them.

animations

A block object containing the changes to commit to the views. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be NULL.

    (4)+ (void)transitionWithView:(UIView *)view
                  duration:(NSTimeInterval)duration
                   options:(UIViewAnimationOptions)options
                animations:(void (^)(void))animations
                completion:(void (^)(BOOL finished))completion
view

The container view that performs the transition.

duration

The duration of the transition animation, measured in seconds. If you specify a negative value or 0, the transition is made without animations.

options

A mask of options indicating how you want to perform the animations. For a list of valid constants, see UIViewAnimationOptions.

animations

A block object that contains the changes you want to make to the specified view. This block takes no parameters and has no return value. This parameter must not be NULL.

completion

A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL.

 可以使用这方法来为一个指定的视图容器创建一个转变动画
    (5)+ (void)transitionFromView:(UIView *)fromView
                    toView:(UIView *)toView
                  duration:(NSTimeInterval)duration
                   options:(UIViewAnimationOptions)options
                completion:(void (^)(BOOL finished))completion
fromView

The starting view for the transition. By default, this view is removed from its superview as part of the transition.

toView

The ending view for the transition. By default, this view is added to the superview of fromView as part of the transition.

duration

The duration of the transition animation, measured in seconds. If you specify a negative value or 0, the transition is made without animations.

options

A mask of options indicating how you want to perform the animations. For a list of valid constants, see UIViewAnimationOptions.

completion

A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL.

从一个视图动画转变到另一个视图
    (6)+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration
                               delay:(NSTimeInterval)delay
                             options:(UIViewKeyframeAnimationOptions)options
                          animations:(void (^)(void))animations
                          completion:(void (^)(BOOL finished))completion
uration

The duration of the overall animation, measured in seconds. If you specify a negative value or 0, changes are made immediately and without animations.

delay

Specifies the time (in seconds) to wait before starting the animation.

options

A mask of options indicating how you want to perform the animations. For a list of valid constants, see “UIViewKeyframeAnimationOptions”.

animations

A block object containing the changes to commit to the views. Typically, you call the addKeyframeWithRelativeStartTime:relativeDuration:animations: method one or more times from inside this block. You may also change view values directly if you want those changes to animate over the full duration. This block takes no parameters and has no return value. Do not use a nil value for this parameter.

completion

A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. You can use a nil value for this parameter.

创建一个以帧为基础的动画
    (7)+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime
                        relativeDuration:(double)frameDuration
                              animations:(void (^)(void))animations
frameStartTime

The time at which to start the specified animations. This value must be in the range 0 to 1, where 0represents the start of the overall animation and 1 represents the end of the overall animation. For example, for an animation that is two seconds in duration, specifying a start time of 0.5 causes the animations to begin executing one second after the start of the overall animation.

frameDuration

The length of time over which to animate to the specified value. This value must be in the range 0 to 1and indicates the amount of time relative to the overall animation length. If you specify a value of 0, any properties you set in the animations block update immediately at the specified start time. If you specify a nonzero value, the properties animate over that amount of time. For example, for an animation that is two seconds in duration, specifying a duration of 0.5 results in an animation duration of one second.

animations

A block object containing the animations you want to perform. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be nil.

在两个不同的值之间进行动画或者扭曲动画的时间都可以调用这个方法
    (7)

+ (void)performSystemAnimation:(UISystemAnimation)animation
                       onViews:(NSArray<__kindof UIView *> *)views
                       options:(UIViewAnimationOptions)options
                    animations:(void (^)(void))parallelAnimations
                    completion:(void (^)(BOOL finished))completion

animation

The system animation to perform; a constant from the UISystemAnimation enum.

views

The views to perform the animations on.

options

A mask of options indicating how you want to perform the animations. For a list of valid constants, see UIViewAnimationOptions.

parallelAnimations

Additional animations you specify to run alongside the system animation, with the same timing and duration that the system animation defines or inherits.

In your additional animations, do not modify properties of the view on which the system animation is being performed.

completion

A block object to be executed when the animation sequence ends. The single Boolean argument indicates whether or not the animations finished before the completion handler was called. If the animation duration is 0, this block is performed at the beginning of the next run-loop cycle. You can use a nil value for this parameter.

 为一个或多个视图执行系统提供的动画

    (8)+ (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

duration

The total duration of the animations, measured in seconds. If you specify a negative value or 0, the changes are made without animating them.

delay

The amount of time (measured in seconds) to wait before beginning the animations. Specify a value of 0 to begin the animations immediately.

dampingRatio

The damping ratio for the spring animation as it approaches its quiescent state.

To smoothly decelerate the animation without oscillation, use a value of 1. Employ a damping ratio closer to zero to increase oscillation.

velocity

The initial spring velocity. For smooth start to the animation, match this value to the view’s velocity as it was prior to attachment.

A value of 1 corresponds to the total animation distance traversed in one second. For example, if the total animation distance is 200 points and you want the start of the animation to match a view velocity of 100 pt/s, use a value of 0.5.

options

A mask of options indicating how you want to perform the animations. For a list of valid constants, see UIViewAnimationOptions.

animations

A block object containing the changes to commit to the views. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be NULL.

completion

A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL.

 使用物理动画弹跳来显示动画
    (9)+ (void)performWithoutAnimation:(void (^)(void))actionsWithoutAnimation    : 视图禁用一个动画过渡
20.动画视图:
    (1)+ (void)beginAnimations:(NSString *)animationID
                context:(void *)context 
animationID

An application-supplied identifier for the animations.

context

Custom data that you want to associate with this set of animations. information that is passed to the animation delegate messages—the selectors set using the setAnimationWillStartSelector: and setAnimationDidStopSelector: methods.

 执行一个或多个动画
    (2)+ (void)commitAnimations :If the current animation set is the outermost set, this method starts the animations when the application returns to the run loop.
    (3)+ (void)setAnimationStartDate:(NSDate *)startTime :为当前的动画设置开始的时间
    (4)+ (void)setAnimationsEnabled:(BOOL)enabled ; yes的时候动画可以使用,no的时候动画不可以使用
    (5)+ (void)setAnimationDelegate:(id)delegate ; 指定一个委托在你接受信息的时候开始或者结束动画
    (6)+ (void)setAnimationWillStartSelector:(SEL)selector ; 当动画开始的时候设置消息发送给动画委托
    (7)+ (void)setAnimationDidStopSelector:(SEL)selector ; 当动画结束的时候设置消息发送给动画委托
    (8)+ (void)setAnimationDuration:(NSTimeInterval)duration:设置动画执行的时间长度
    (9)+ (void)setAnimationDelay:(NSTimeInterval)delay ;设置多长时间后开始执行动画
    (10)+ (void)setAnimationCurve:(UIViewAnimationCurve)curve设置使用的曲线当动画属性改变的时候
    (11)+ (void)setAnimationRepeatCount:(float)repeatCount ; 设置动画重复的时间
    (12)+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses ; 设置动画是否可以反方向重复
    (13)+ (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState ;设置视图是否应该从当前的状态开始执行动画
    (14)+ (void)setAnimationTransition:(UIViewAnimationTransition)transition
                       forView:(UIView *)view
                         cache:(BOOL)cache
transition

A transition to apply to view. Possible values are described in UIViewAnimationTransition.

view

The view to apply the transition to.

cache

If YES, the before and after images of view are rendered once and used to create the frames in the animation. Caching can improve performance but if you set this parameter to YES, you must not update the view or its subviews during the transition. Updating the view and its subviews may interfere with the caching behaviors and cause the view contents to be rendered incorrectly (or in the wrong location) during the animation. You must wait until the transition ends to update the view.

If NO, the view and its contents must be updated for each frame of the transition animation, which may noticeably affect the frame rate.

解释:If you want to change the appearance of a view during a transition—for example, flip from one view to another—then use a container view, an instance of UIView,
    (15)+ (BOOL)areAnimationsEnabled ;返回一个布尔值,指定动画是否可以执行
21.使用动作功能
    (1)- (void)addMotionEffect:(UIMotionEffect *)effect ; 为视图添加一个动作功能
    (2)@property(copy, nonatomic) NSArray<__kindof UIMotionEffect *> *motionEffects ; 获取视图的动作数组
    (3)- (void)removeMotionEffect:(UIMotionEffect *)effect ;移除动作功能
22.恢复和存储状态:
    (1)@property(nonatomic, copy) NSString*restorationIdentifier ; 这个标示决定视图是否可以保存和恢复状态
    (2)- (void)encodeRestorableStateWithCoder:(NSCoder *)coder ;如果你的软件支持恢复功能,可以为视图重载这个方法编码相关状态
    (3)- (void)decodeRestorableStateWithCoder:(NSCoder *)coder ;从视图解码和保存状态关系信息
23.配置一个快照
    (1)- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates ; 在基于当前内容中返回一个快照视图
    (2)- (UIView *)resizableSnapshotViewFromRect:(CGRect)rect
                       afterScreenUpdates:(BOOL)afterUpdates
                            withCapInsets:(UIEdgeInsets)capInsets
rect

The portion of the view that you want to capture. The rectangle must be in the bounds coordinate space of the current view.

afterUpdates

A Boolean value that specifies whether the snapshot should be taken after recent changes have been incorporated. Pass the value NO if you want to capture the screen in its current state, which might not include recent changes.

capInsets

The edge insets that define the stretchable portion of the returned view’s content. You can specify UIEdgeInsetsZero if you do not want the contents of the returned view to have a stretchable area.

 获得当前视图内容的快照,并且对快照进行编辑,可编辑的内容为到边界的距离
    (3)- (BOOL)drawViewHierarchyInRect:(CGRect)rect
             afterScreenUpdates:(BOOL)afterUpdates
rect

A rectangle specified in the local coordinate system (bounds) of the view.

afterUpdates

A Boolean value that indicates whether the snapshot should be rendered after recent changes have been incorporated. Specify the value NO if you want to render a snapshot in the view hierarchy’s current state, which might not include recent changes.

当你想要应用一个图形功能的时候可以使用这个方法
23.在运行期间标示视图
    (1)@property(nonatomic) NSIntegertag : 用一个数值来标识一个视图
    (2)- (__kindof UIView *)viewWithTag:(NSInteger)tag ; 返回一个特定标识的视图
24.转换两个视图之间的坐标系统:
    (1)

- (CGPoint)convertPoint:(CGPoint)point
                 toView:(UIView *)view

point

A point specified in the local coordinate system (bounds) of the receiver.

view

The view into whose coordinate system point is to be converted. If view is nil, this method instead converts to window base coordinates. Otherwise, both view and the receiver must belong to the same UIWindow object.

 转换接收者坐标系统中的点到指定的视图

    (2)- (CGPoint)convertPoint:(CGPoint)point
               fromView:(UIView *)view

point

A point specified in the local coordinate system (bounds) of view.

view

The view with point in its coordinate system. If view is nil, this method instead converts from window base coordinates. Otherwise, both view and the receiver must belong to the same UIWindow object.    

   从一个视图坐标系统中转换一个点到接收者坐标系统中
    (3)- (CGRect)convertRect:(CGRect)rect
               toView:(UIView *)view
rect

A rectangle specified in the local coordinate system (bounds) of the receiver.

view

The view that is the target of the conversion operation. If view is nil, this method instead converts to window base coordinates. Otherwise, both view and the receiver must belong to the same UIWindow object.

 从接收者系统中转换一个矩形到指定的视图坐标系统中
    (4)- (CGRect)convertRect:(CGRect)rect
             fromView:(UIView *)view
rect

A rectangle specified in the local coordinate system (bounds) of view.

view

The view with rect in its coordinate system. If view is nil, this method instead converts from window base coordinates. Otherwise, both view and the receiver must belong to the same UIWindow object.  

从一个视图转换一个矩形到接收者坐标系统中
25.测试视图
    (1)- (UIView *)hitTest:(CGPoint)point
          withEvent:(UIEvent *)event
point

A point specified in the receiver’s local coordinate system (bounds).

event

The event that warranted a call to this method. If you are calling this method from outside your event-handling code, you may specify nil.

  返回响应链中可以接受某个点触发的事件的视图
     (2)- (BOOL)pointInside:(CGPoint)point
          withEvent:(UIEvent *)event
point

A point that is in the receiver’s local coordinate system (bounds).

event

The event that warranted a call to this method. If you are calling this method from outside your event-handling code, you may specify nil.

如果点在接受者的边界内部返回yes
    (3)- (BOOL)endEditing:(BOOL)force ,从当前视图或者子视图中寻找文本的响应,如果为第一响应者就放弃这个响应,如果force为yes那么这个文本将会永远不会得到第一响应
26.观察视图相关的改变
    (1)- (void)didAddSubview:(UIView *)subview ; 这个方法主要用来重载,并告诉视图子视图已经添加
    (2)- (void)willRemoveSubview:(UIView *)subview ; 用来重载的时候告诉视图子视图已经删除
    (3)- (void)willMoveToSuperview:(UIView *)newSuperview ; 用来重载的时候确定将会在什么时候改变父视图
    (4)- (void)didMoveToSuperview ; 重载的时候告诉视图已经转移到其他的父视图
    (5)- (void)willMoveToWindow:(UIWindow *)newWindow ; 重载时候转移到新的窗口
    (6)- (void)didMoveToWindow ; 重载的时候告诉视图已经移动到窗口
27.观察聚焦
    (1)- (BOOL)canBecomeFocused ; 询问视图是否可以成为当前成为焦点的可能
    (2)+ (NSTimeInterval)inheritedAnimationDuration ;返回the inherited duration of the current animation.
    (3)@property(readonly, nonatomic, getter=isFocused) BOOL focused ; 指定这个项目是否当前被关注
28.数据类型
    
    UIViewAnimationOptions的类型:
UIViewAnimationOptionLayoutSubviews = 1 << 0, :  Lay out subviews at commit time so that they are animated along with their parent. 
UIViewAnimationOptionAllowUserInteraction = 1 << 1,  动画允许和用户相交互
UIViewAnimationOptionBeginFromCurrentState = 1 << 2,  : 从当前的设置状态开始动画
UIViewAnimationOptionRepeat = 1 << 3,  :无限循环动画
UIViewAnimationOptionAutoreverse = 1 << 4,   : 使动画向前播放和向后播放都需要使用这个
UIViewAnimationOptionOverrideInheritedDuration = 1 << 5,  : Force the animation to use the original duration value specified when the animation was submitted.
UIViewAnimationOptionOverrideInheritedCurve = 1 << 6,  :Force the animation to use the original curve value specified when the animation was submitted
UIViewAnimationOptionAllowAnimatedContent = 1 << 7,  : 动画视图通过改变这个值来重画视图
UIViewAnimationOptionShowHideTransitionViews = 1 << 8, :当执行转换视图时这个视图会被隐藏或者显示
UIViewAnimationOptionOverrideInheritedOptions = 1 << 9, :选择不继承动画类型或任何选项。
UIViewAnimationOptionCurveEaseInOut = 0 << 16,  :动画使用高斯曲线,就是s形的
UIViewAnimationOptionCurveEaseIn = 1 << 16,  :一开始是慢然后慢慢变快的曲线,递增曲线
UIViewAnimationOptionCurveEaseOut = 2 << 16,  :一开始很快慢慢变慢的曲线,递增曲线
UIViewAnimationOptionCurveLinear = 3 << 16,  : 线性动画曲线,动画发生的时间都是均匀的
UIViewAnimationOptionTransitionNone = 0 << 20,  :没有转换效果
UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20,  以垂直为中心,视图从左向右转,就像酒店的旋转门
UIViewAnimationOptionTransitionFlipFromRight = 2 << 20,  :以垂直为中心,视图从右向左旋转,就像酒店的旋转门
UIViewAnimationOptionTransitionCurlUp = 3 << 20,  :从下面向上面卷动
UIViewAnimationOptionTransitionCurlDown = 4 << 20,  :从上面向下面卷动
UIViewAnimationOptionTransitionCrossDissolve = 5 << 20,  :一个视图以溶解的形式向另一个视图进行转换
UIViewAnimationOptionTransitionFlipFromTop = 6 << 20,  :以中心水平为轴,从上面向下面旋转
UIViewAnimationOptionTransitionFlipFromBottom = 7 << 20,  :以水平中心轴为轴,从下面向上面旋转
 
 
UIViewContentModeScaleToFill,  :The option to scale the content to fit the size of itself by changing the aspect ratio of the content if necessary
UIViewContentModeScaleAspectFit,  :The option to scale the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent. 
UIViewContentModeScaleAspectFill,  :按照内容的比例填满视图,有一部分内容可能会跑出视图的范围
UIViewContentModeRedraw,  : 通过使用setNeedsDisplay方法可以重画视图
UIViewContentModeCenter,  :保持内容在视图的中心
UIViewContentModeTop,  :保持内容在顶部
UIViewContentModeBottom,  :保持内容在底部
UIViewContentModeLeft,  :保持内容在左边
UIViewContentModeRight,  :保持内容在右边
UIViewContentModeTopLeft,  :保持内容在左上方
UIViewContentModeTopRight, :保持内容在右上方
UIViewContentModeBottomLeft,   :保持内容在左下面
UIViewContentModeBottomRight,  :保持内容在右下面
 
UIViewTintAdjustmentModeAutomatic,   :色彩调整模式是它的父视图的色彩调整模式(或UIViewTintAdjustmentModeNormal如果视图没有父视图)。
UIViewTintAdjustmentModeNormal,  :返回视图没有更改的色彩
UIViewTintAdjustmentModeDimmed,  :返回一个减小饱和度或者说是暗淡的颜色
 
4.UISystemAnimation的类型:
UISystemAnimationDelete,  :当动画被执行的时候把视图从视图链中删除
 
5.UIViewAutoresizing的类型:
UIViewAutoresizingNone = 0,  :指定视图不调整大小
UIViewAutoresizingFlexibleLeftMargin = 1 << 0,   :从左边缘进行放大或者缩小进行调整大小
UIViewAutoresizingFlexibleWidth = 1 << 1,  :通过放大或者缩小宽度来调整大小
UIViewAutoresizingFlexibleRightMargin = 1 << 2,  :通过从右边缘进行放大或者缩小来进行调整大小
UIViewAutoresizingFlexibleTopMargin = 1 << 3,  :通过从上边缘进行放大或者缩小来进行调整大小
UIViewAutoresizingFlexibleHeight = 1 << 4,  :通过从高度进行放大或者缩小来调整大小
UIViewAutoresizingFlexibleBottomMargin = 1 << 5  :通过底部边缘进行放大或者缩小来调整大小
 
UIViewAnimationTransitionNone,  :没有指定的动画转换
UIViewAnimationTransitionFlipFromLeft,  :从左向右翻转
UIViewAnimationTransitionFlipFromRight,  :从右向左翻转
UIViewAnimationTransitionCurlUp,  :向上翻转
UIViewAnimationTransitionCurlDown,  :向下翻转
 
UIViewKeyframeAnimationOptionLayoutSubviews = UIViewAnimationOptionLayoutSubviews,  :会跟着父视图进行动画
UIViewKeyframeAnimationOptionAllowUserInteraction = UIViewAnimationOptionAllowUserInteraction,  :当进行动画的时候允许进行交互
UIViewKeyframeAnimationOptionBeginFromCurrentState = UIViewAnimationOptionBeginFromCurrentState,  :从当前的状态进行动画
UIViewKeyframeAnimationOptionRepeat = UIViewAnimationOptionRepeat,  :无限重复动画
UIViewKeyframeAnimationOptionAutoreverse = UIViewAnimationOptionAutoreverse,  :使动画可以向前播放也可以向后播放,但是需要联合UIViewKeyframeAnimationOptionRepeat使用
UIViewKeyframeAnimationOptionOverrideInheritedDuration = UIViewAnimationOptionOverrideInheritedDuration,  :The option to force an animation to use the original duration value specified when the animation was submitted 
UIViewKeyframeAnimationOptionOverrideInheritedOptions = UIViewAnimationOptionOverrideInheritedOptions,  :这个选项没有继承动画类型或者任何的选项
UIViewKeyframeAnimationOptionCalculationModeLinear = 0 << 9,  :The option to use a simple linear calculation when interpolating between keyframe values.
UIViewKeyframeAnimationOptionCalculationModeDiscrete = 1 << 9,  :The option to not interpolate between keyframe values, but rather to jump directly to each new keyframe value.
UIViewKeyframeAnimationOptionCalculationModePaced = 2 << 9,  :The option to compute intermediate keyframe values using a simple pacing algorithm. This option results in an evenly paced animation.
UIViewKeyframeAnimationOptionCalculationModeCubic = 3 << 9,  :The option to compute intermediate frames using a default Catmull-Rom spline that passes through the keyframe values. You cannot adjust the parameters of this algorithm.
UIViewKeyframeAnimationOptionCalculationModeCubicPaced = 4 << 9  :The option to compute intermediate frames using the cubic scheme while ignoring the timing properties of the animation. Instead, timing parameters are calculated implicitly to give the animation a constant velocity.
 
8.UILayoutConstraintAxis的类型:
UILayoutConstraintAxisHorizontal = 0,  :当布局对象之间的水平约束的时候这个约束就会被使用
UILayoutConstraintAxisVertical = 1  :当布局对象之间的垂直约束的时候这个约束就会被使用
 

const CGSize UILayoutFittingCompressedSize;  :这个选项尽可能的使用最小的尺寸

const CGSize UILayoutFittingExpandedSize;  :这个选项尽可能的使用最大的尺寸

10.UISemanticContentAttribute的类型:

UISemanticContentAttributeUnspecified = 0,  :The view is flipped when switching between left-to-right and right-to-left layouts

UISemanticContentAttributePlayback,  :A view representing the playback controls, such as Play, Rewind, or Fast Forward buttons or playhead scrubbers

UISemanticContentAttributeSpatial,  :A view representing a directional control, such as a segment control for text alignment, or a D-pad control for a game.

UISemanticContentAttributeForceLeftToRight,  :视图总是从左向右布局

UISemanticContentAttributeForceRightToLeft  :视图总是从右向左布局