UIView全部API的翻译(1)

               UIView全部API的翻译(1)

UIView是iOS系统界面元素的基础,所有的界面元素都是继承于它.它本身是由CoreAnimation来实现的.它真正的绘图部分,是由一个叫CALayer的类来管理的.UIView更像是CALayer的管理器,访问它的跟绘图相关的属性,例如frame,bounds等等等等,实际上内部都是访问它所包含CALayer的相关属性.

View设置动画块中动画属性变化的曲线

typedef NS_ENUM(NSInteger, UIViewAnimationCurve) {

UIViewAnimationCurveEaseInOut,        // 缓慢的开始和结束

UIViewAnimationCurveEaseIn,            // 在缓慢的开始

UIViewAnimationCurveEaseOut,          // 在缓慢的结束

UIViewAnimationCurveLinear

};

View内部内容不同显示类型效果   

typedefNS_ENUM(NSInteger, UIViewContentMode) {

UIViewContentModeScaleToFill,

UIViewContentModeScaleAspectFit,      // 内容符合固定的方面。剩余部分是透明的

UIViewContentModeScaleAspectFill,    // 内容扩展填充固定方面。部分内容可能剪。

UIViewContentModeRedraw,              // 范围变化重绘 (调用setNeedsDisplay)

UIViewContentModeCenter,              // 内容保持相同大小。定位调整。

UIViewContentModeTop,

UIViewContentModeBottom,

UIViewContentModeLeft,

UIViewContentModeRight,

UIViewContentModeTopLeft,

UIViewContentModeTopRight,

UIViewContentModeBottomLeft,

UIViewContentModeBottomRight,

};

五种动画效果

typedefNS_ENUM(NSInteger, UIViewAnimationTransition) {

UIViewAnimationTransitionNone, 没有动画

UIViewAnimationTransitionFlipFromLeft, 从左向右旋转翻页

UIViewAnimationTransitionFlipFromRight, 从右向左旋转翻页

UIViewAnimationTransitionCurlUp, 卷曲翻页,从下往上

UIViewAnimationTransitionCurlDown, 卷曲翻页 从上往下

};

这些属性是为了自动调整子试图于父试图中间的位置,宽高

typedefNS_OPTIONS(NSUInteger, UIViewAutoresizing) {

UIViewAutoresizingNone                =0,  不自动调整

UIViewAutoresizingFlexibleLeftMargin  =1 << 0, 自动调整与superView左边的距离,保证与superView左边的距离不变

UIViewAutoresizingFlexibleWidth        =1 << 1, 自动调整自己的宽度,保证与superView左边和右边的距离不变

UIViewAutoresizingFlexibleRightMargin  =1 << 2, 自动调整与superView的右边距离,保证与superView左边的距离不变

UIViewAutoresizingFlexibleTopMargin    =1 << 3, 自动调整与superView顶部的距离,保证与superView底部的距离不变

UIViewAutoresizingFlexibleHeight      =1 << 4, 自动调整自己的高度,保证与superView左边和邮编的距离不变

UIViewAutoresizingFlexibleBottomMargin =1 << 5, 自动调整与superView底部的距离,保证与superView顶部的距离不变

};

关于动画option的一些选项

typedefNS_OPTIONS(NSUInteger, UIViewAnimationOptions) {

UIViewAnimationOptionLayoutSubviews            =1 <<  0, 提交动画的时候布局子控件,表示子控件将和父控件一同动画

UIViewAnimationOptionAllowUserInteraction      =1 <<  1, 动画时允许用户交流,比如触摸

UIViewAnimationOptionBeginFromCurrentState    =1 <<  2, 从当前状态开始动画

UIViewAnimationOptionRepeat                    =1 <<  3, 动画无限重复

UIViewAnimationOptionAutoreverse              =1 <<  4, 执行动画回路,前提是设置动画无限重复

UIViewAnimationOptionOverrideInheritedDuration =1 <<  5, 忽略外层动画嵌套的执行时间

UIViewAnimationOptionOverrideInheritedCurve    =1 <<  6, 忽略外层动画嵌套的时间变化曲线

UIViewAnimationOptionAllowAnimatedContent      =1 <<  7, 通过改变属性和重回实现动画效果,如果key没有提交动画将使用快照

UIViewAnimationOptionShowHideTransitionViews  =1 <<  8, 用显隐的方式替代添加移除图层的动画效果

UIViewAnimationOptionOverrideInheritedOptions  =1 <<  9, 忽略嵌套继承的选项

UIViewAnimationOptionCurveEaseInOut            =0 << 16, 时间曲线函数,由慢到快

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, 转场从下翻转

} NS_ENUM_AVAILABLE_IOS(4_0);

关键帧动画的选项参数设置

typedefNS_OPTIONS(NSUInteger, UIViewKeyframeAnimationOptions) {

UIViewKeyframeAnimationOptionLayoutSubviews            =UIViewAnimationOptionLayoutSubviews,

UIViewKeyframeAnimationOptionAllowUserInteraction      =UIViewAnimationOptionAllowUserInteraction, // 打开用户交互动画

UIViewKeyframeAnimationOptionBeginFromCurrentState    =UIViewAnimationOptionBeginFromCurrentState, // 从当前值开始所有视图,而不是初始值

UIViewKeyframeAnimationOptionRepeat                    =UIViewAnimationOptionRepeat, // 无限期重复动画

UIViewKeyframeAnimationOptionAutoreverse              =UIViewAnimationOptionAutoreverse, //如果重复,来回运行动画

UIViewKeyframeAnimationOptionOverrideInheritedDuration =UIViewAnimationOptionOverrideInheritedDuration,// 忽略嵌套的持续时间

UIViewKeyframeAnimationOptionOverrideInheritedOptions  =UIViewAnimationOptionOverrideInheritedOptions,// 不继承任何选项或动画类型

UIViewKeyframeAnimationOptionCalculationModeLinear    =0 << 10, // 默认

UIViewKeyframeAnimationOptionCalculationModeDiscrete  =1 << 10,

UIViewKeyframeAnimationOptionCalculationModePaced      =2 << 10,

UIViewKeyframeAnimationOptionCalculationModeCubic      =3 << 10,

UIViewKeyframeAnimationOptionCalculationModeCubicPaced =4 << 10

} NS_ENUM_AVAILABLE_IOS(7_0);

typedefNS_ENUM(NSUInteger, UISystemAnimation) {

UISystemAnimationDelete,    //从层次结构中删除视图时完成

} NS_ENUM_AVAILABLE_IOS(7_0);

typedefNS_ENUM(NSInteger, UIViewTintAdjustmentMode) {

UIViewTintAdjustmentModeAutomatic, 试图着色自动调整

UIViewTintAdjustmentModeNormal, 试图着色正常

UIViewTintAdjustmentModeDimmed, 试图着色慢慢变暗

} NS_ENUM_AVAILABLE_IOS(7_0);

typedef NS_ENUM(NSInteger, UISemanticContentAttribute) {    UISemanticContentAttributeUnspecified = 0,    UISemanticContentAttributePlayback, // 打开/ RW / FF等播放控制按钮和播放头磨砂 UISemanticContentAttributeSpatial, // 控制导致某种形式的定向改变UI中,如分段控制文本对齐方式或在游戏中方向键  

 UISemanticContentAttributeForceLeftToRight,    UISemanticContentAttributeForceRightToLeft} NS_ENUM_AVAILABLE_IOS(9_0);typedef NS_ENUM(NSInteger, UIUserInterfaceLayoutDirection) {    UIUserInterfaceLayoutDirectionLeftToRight,    UIUserInterfaceLayoutDirectionRightToLeft,} NS_ENUM_AVAILABLE_IOS(5_0);@protocol UICoordinateSpace- (CGPoint)convertPoint:(CGPoint)point toCoordinateSpace:(id)coordinateSpace NS_AVAILABLE_IOS(8_0);- (CGPoint)convertPoint:(CGPoint)point fromCoordinateSpace:(id)coordinateSpace NS_AVAILABLE_IOS(8_0);- (CGRect)convertRect:(CGRect)rect toCoordinateSpace:(id)coordinateSpace NS_AVAILABLE_IOS(8_0);- (CGRect)convertRect:(CGRect)rect fromCoordinateSpace:(id)coordinateSpace NS_AVAILABLE_IOS(8_0);

@property (readonly, nonatomic) CGRect bounds NS_AVAILABLE_IOS(8_0);

@end

@class UIBezierPath, UIEvent, UIWindow, UIViewController, UIColor, UIGestureRecognizer, UIMotionEffect, CALayer, UILayoutGuide;

NS_CLASS_AVAILABLE_IOS(2_0) 

@interface UIView : UIResponder

UIView有个layer属性,可以返回它的主CALayer实例,UIView有一个layerClass方法,返回主layer所使用的类,UIView的子类,可以通过重载这个方法,来让UIView使用不同的CALayer来显示。

+ (Class)layerClass;              // 默认是(CALayer类)。当创建底层层用于视图。

初始化View并设置frame的大小

- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;

这个属性是设置View是否支持触摸点击

@property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled;  // 默认是肯定的。如果没有设置,用户事件(触摸键)被忽略和从事件队列中删除。

给View加tag值

@property(nonatomic) NSInteger tag;                // 默认为 0

View的layer属性

@property(nonatomic,readonly,strong)                CALayer  *layer;              // 返回视图层。总是返回一个非nil值。视图层的代理

- (BOOL)canBecomeFocused NS_AVAILABLE_IOS(9_0); // 默认为NO 

@property (readonly, nonatomic, getter=isFocused) BOOL focused NS_AVAILABLE_IOS(9_0);

+ (UIUserInterfaceLayoutDirection)userInterfaceLayoutDirectionForSemanticContentAttribute:(UISemanticContentAttribute)attribute NS_AVAILABLE_IOS(9_0);

@end

@interface UIView(UIViewGeometry)

可以做成动画。不使用框架如果正确的观点是改变了,因为它不会反映实际位置的视图。使用范围+中心。

设置View的位置和尺寸,是以父试图为参照系

@property(nonatomic) CGRect            frame;

 使用范围/中心而不是框架如果non-identity变换。如果范围维度是奇数,中心可能会有小数部分

位置和尺寸,是以自己为参照系

@property(nonatomic) CGRect            bounds;      // 默认范围是0起源、帧大小。可以做成动画

中心点的坐标,是以父试图为参照系

@property(nonatomic) CGPoint          center;      //中心的中心框架。可以做成动画

View形变属性 缩放 旋转

@property(nonatomic) CGAffineTransform transform;  // 默认是CGAffineTransformIdentity。可以做成动画

内容比例

@property(nonatomic) CGFloat          contentScaleFactor NS_AVAILABLE_IOS(4_0);

是否支持支持多点触摸

@property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled __TVOS_PROHIBITED;  // 默认值是 NO

如果设置为YES则当前UIView会独占整个Touch事件。具体来说就是如果UIView设置了exclusiveTouch属性为YES则当这个UIView成为第一响应者时,在手指离开屏幕前其他view不会相应任何touch事件。

@property(nonatomic,getter=isExclusiveTouch) BOOL      exclusiveTouch __TVOS_PROHIBITED;        // 默认是NO

当一个View上添加一个屏幕罩时,但又不影响View的操作,也就是可以通过屏幕对线面的View进行操作.

- (nullable UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event;  // 递归地调用-pointInside:withEvent:。点是在接收机的坐标系统

这个函数的用处是判断当前的点击或者触摸事件是否在当前的View中

- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event;  // 在试图里面就返回YES

转换一个点从接收者坐标系到给定试图的坐标系

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

把一个点从一个坐标系转换到接受者的坐标系

- (CGPoint)convertPoint:(CGPoint)point fromView:(nullable UIView *)view;

转换接受者坐标系中的矩形到其他试图

- (CGRect)convertRect:(CGRect)rect toView:(nullable UIView *)view;

转换一个矩形从其他试图坐标系到接受者坐标系

- (CGRect)convertRect:(CGRect)rect fromView:(nullable UIView *)view;

如果某个视图的这个属性被设置为YES,则其子视图会根据autoresizingMask属性的值自动进行尺寸调整,简单配置一下视图的自动尺寸调整掩码常常就能使应用程序得到合适的行为。否则,应用程序就必须通过重载layoutSubviews方法来提供自己的实现

@property(nonatomic) BOOL              autoresizesSubviews; //默认是YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes

自动调整子试图于父试图中间的位置,宽高

@property(nonatomic) UIViewAutoresizing autoresizingMask;    // 简单的调整。默认是UIViewAutoresizingNone

这个方法会计算并且返回一个最实用接受子试图的大小

- (CGSize)sizeThatFits:(CGSize)size;    //返回“最佳”大小适合给定的大小。实际上并没有调整的观点。默认返回现有视图大小

移动并且调整试图的大小

- (void)sizeToFit;                      // 调用sizeThatFits:当前视图范围和变化范围的大小。

@end

@interface UIView(UIViewHierarchy)

取到父试图

@property(nullable, nonatomic,readonly) UIView      *superview;

取到View上所有的子试图

@property(nonatomic,readonly,copy) NSArray<__kindof UIView *> *subviews;

屏幕窗口

@property(nullable, nonatomic,readonly) UIWindow    *window;

把当前的试图从它的父试图上移除

- (void)removeFromSuperview;

将试图插入到子试图中,并可以设置索引值

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

交换指定位置的两个试图的位置

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

添加一个子试图,新添加的子试图默认添加到subViews数组的最后面,他会显示在最上层

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

添加一个子试图在siblingSubview子试图的线面

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

添加一个子视图在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:(nullable UIView *)newSuperview;

通知已经移动到新的父试图

- (void)didMoveToSuperview;

通知即将移动到进的窗口

- (void)willMoveToWindow:(nullable UIWindow *)newWindow;

通知已经移动到新的窗口

- (void)didMoveToWindow;

返回一个bool值,判断某个试图是不是View的子试图或者子试图的子试图

- (BOOL)isDescendantOfView:(UIView *)view;  // 返回 YES 代表是他的子试图

通过tag值来获取对应tag的试图

- (nullable __kindof UIView *)viewWithTag:(NSInteger)tag; //递归搜索。包括自己

//允许你在画周期发生之前进行布局。-layoutIfNeeded部队提前布局

在对现有的布局有调整更改后,使用这个方法更新

- (void)setNeedsLayout;

强制进行更新layout,通常与上面的方法结合使用

- (void)layoutIfNeeded;

一般写在View的内部,当控件的大小约束发生变化的时候在这里重写布局子控件的位置和尺寸,一般这个方法里面或者试图的frame是最精确的

- (void)layoutSubviews;    // 覆盖点。自动调用layoutIfNeeded。iOS 6.0,当使用constraints-based布局基本实现应用constraints-based布局,否则什么也不做。

/*

-layoutMargins返回一组从视图边界的边缘insets,表示默认间距布置的内容。

如果preservesSuperviewLayoutMargins是肯定的,利润率级联树视图,调整几何偏移,所以设置的左值layoutMargins在父视图将影响左边的layoutMargins值子视图位置的左边缘父视图的范围

如果您的视图子类使用layoutMargins布局或绘画,覆盖-layoutMarginsDidChange为了刷新视图,如果边缘变化

*/

iOS8的新特性,用这个属性可以定义View之间的间距,该属性只对autolayout布局有效.

@property (nonatomic) UIEdgeInsets layoutMargins NS_AVAILABLE_IOS(8_0);

preservesSuperviewLayoutMargins这个属性默认是NO,如果把它设为YES,layoutMargins会根据屏幕中相关view的布局而改变。

@property (nonatomic) BOOL preservesSuperviewLayoutMargins NS_AVAILABLE_IOS(8_0); // 默认为 NO - 直通或级联行为将使边缘从这个视图的父试图的子试图

在我们改变view的layoutMargins这个属性时,会触发这个方法,我们在自己的view里面可以重写这个方法来捕获layoutMargins的变化。在大多数情况下,我们可以在这个方法里面触发drawing和layout的update。

- (void)layoutMarginsDidChange NS_AVAILABLE_IOS(8_0);

/* 本指南的边缘限制等于layoutMarginsn视图插图的边缘

*/

@property(readonly,strong) UILayoutGuide *layoutMarginsGuide NS_AVAILABLE_IOS(9_0);

/// 这个内容指南提供了一个布局区域,您可以使用文本和相关内容的宽度通常应该限制大小,便于用户阅读。本指南提供了一个集中区域,您可以将内容在这个行为这一观点。

布局指南

@property (nonatomic, readonly, strong) UILayoutGuide *readableContentGuide  NS_AVAILABLE_IOS(9_0);

@end

@interface UIView(UIViewRendering)

如果我们想要在一个UIView中绘图,需要写一个扩展UIView的类,并重写drawRect方法,在这里进行绘图操作。这个方法不能直接调用。苹果要求我们调用UIView类中的setNeedsDisplay方法,则程序会自动调用drawRect方法进行重回(调用setNeedsDisplay会自动调用drawRect)

- (void)drawRect:(CGRect)rect;

调用这个方法会自动调用drawRect方法

- (void)setNeedsDisplay;

同上,直接调用setNeedsDisplay,或者setNeedsDisplayInRect触发drawRect,但是有个前提条件是rect不能为0

- (void)setNeedsDisplayInRect:(CGRect)rect;

当是YES的时候,如果子试图的范围超过父试图的边界,超出的部分会被裁掉

@property(nonatomic)BOOL  clipsToBounds;              //当是YES的时候,内容和子试图超出了View的范围,默认是NO.

View的背景颜色

@property(nullable, nonatomic,copy)UIColor          *backgroundColor UI_APPEARANCE_SELECTOR; //默认是空。可以在自定义UIView有用外观代理子类。

View的透明度

@property(nonatomic)  CGFloat alpha;    // 可以做成动画。默认是1.0

不透明度

@property(nonatomic,getter=isOpaque) BOOL  opaque;                    // 默认是 YES. 不透明的观点必须填补他们的整个范围或结果是未定义的。绘制矩形的活跃CGContext:不会被清除,可能非零像素.

如果设置为YES,在view请求之前都会清楚current context buffer,来更新相同区域

@property(nonatomic)  BOOL  clearsContextBeforeDrawing; // 默认识 YES. 忽视了对不透明的观点。非模糊交易观点导致绘制矩形活动CGContext:预先填充透明像素

隐藏

@property(nonatomic,getter=isHidden) BOOL              hidden;                    // 默认是 NO. 不检查父视图

显示内容的模式

@property(nonatomic)                UIViewContentMode contentMode;                // 默认是 UIViewContentModeScaleToFill

图片的拉伸操作

@property(nonatomic)                CGRect            contentStretch NS_DEPRECATED_IOS(3_0,6_0) __TVOS_PROHIBITED; // animatable. default is unit rectangle {{0,0} {1,1}}. Now deprecated: please use -[UIImage resizableImageWithCapInsets:] to achieve the same effect.

蒙版View

@property(nullable, nonatomic,strong)          UIView          *maskView NS_AVAILABLE_IOS(8_0);

/*

-tintColor总是返回一个颜色。返回的颜色是第一个非默认值在接收机的父视图链(从本身)。

如果没有找到非默认值,返回一个系统定义的颜色。

如果这个视图的-tintAdjustmentMode返回变暗,颜色返回-tintColor将自动变暗。

如果您的视图子类使用tintColor渲染,覆盖-tintColorDidChange为了刷新呈现颜色变化。

*/

这个属性使用是改变应用程序的外观的。默认tintColor的值为nil,这表示它将会运用父食欲层次的颜色来进行着色。如果父视图中没有设置tintColor,那么默认系统就会使用蓝色。因此,可以通过root view controller的tintColor来改变系统整体的颜色。

@property(null_resettable, nonatomic, strong) UIColor *tintColor NS_AVAILABLE_IOS(7_0);

/*

-tintAdjustmentMode总是返回UIViewTintAdjustmentModeNormal或UIViewTintAdjustmentModeDimmed。返回的值是第一个非默认值在接收机的父视图链(从本身)。

如果没有找到非默认值,返回UIViewTintAdjustmentModeNormal。

当tintAdjustmentMode值UIViewTintAdjustmentModeDimmed视图,它返回从tintColor将颜色修改为黯淡的外观。

当一个视图的tintAdjustmentMode变化(改变视图的价值或通过改变它的父视图的一个值),-tintColorDidChange将被允许视图刷新渲染。

*/

这个属性可以使tintColor变暗,因此整个视图层次变暗。并且它又三个值在里面选择一个设置。

@property(nonatomic) UIViewTintAdjustmentMode tintAdjustmentMode NS_AVAILABLE_IOS(7_0);

/*

-tintColorDidChange消息发送给适当的视图的子视图时tintColor改变由客户机代码或视图的子视图在视图层次的tintColor时隐式地改变它的父视图或tintAdjustmentMode变化。

*/

覆盖这个方法的目的是为了当tintColor改变的时候自定义一些行为。

- (void)tintColorDidChange NS_AVAILABLE_IOS(7_0);

@end

@interface UIView(UIViewAnimation)

开始动画

+ (void)beginAnimations:(nullable NSString *)animationID context:(nullable void *)context;  // 额外的上下文信息传递给会启动/停止选择器。开始/提交可以嵌套

提交动画

+ (void)commitAnimations;                                                // 启动任何动画顶级动画时提交

// 没有getter。如果称为动画外块,这些setter方法没有效果。

设置动画代理

+ (void)setAnimationDelegate:(nullable id)delegate;                          // 默认 = nil

动画将要开始时执行方法

+ (void)setAnimationWillStartSelector:(nullable SEL)selector;                // default = NULL. -animationWillStart:(NSString *)animationID context:(void *)context

动画已经结束时执行方法

+ (void)setAnimationDidStopSelector:(nullable SEL)selector;                  // default = NULL. -animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context

设置动画时长

+ (void)setAnimationDuration:(NSTimeInterval)duration;              // default = 0.2

动画延迟执行时间

+ (void)setAnimationDelay:(NSTimeInterval)delay;                    // default = 0.0

设置在动画块内部动画属性改变的开始时间

+ (void)setAnimationStartDate:(NSDate *)startDate;                  // default = now ([NSDate date])

设置动画曲线,默认是匀速进行

+ (void)setAnimationCurve:(UIViewAnimationCurve)curve;              // default = UIViewAnimationCurveEaseInOut

动画的重复播放次数

+ (void)setAnimationRepeatCount:(float)repeatCount;                // default = 0.0.  May be fractional

设置是否自定翻转当前的动画效果

+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses;    // default = NO. 如果使用重复计数不为零

设置动画当前状态开始播放

+ (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState;  // default = NO. If YES, the current view position is always used for new animations -- allowing animations to "pile up" on each other. Otherwise, the last end state is used for the animation (the default).

在动画块中为试图设置过渡

+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache;  // current limitation - only one per begin/commit block

设置是否激活动画

+ (void)setAnimationsEnabled:(BOOL)enabled;                        // ignore any attribute changes while set.

返回一个bool表示动画是否结束

+ (BOOL)areAnimationsEnabled;

先检查动画当前是否启用,然后禁止动画,执行block内的方法,然后重新启动动画,而且这个方法不会阻塞基于CoreAnimation的动画

+ (void)performWithoutAnimation:(void (^)(void))actionsWithoutAnimation NS_AVAILABLE_IOS(7_0);

继承动画时间

+ (NSTimeInterval)inheritedAnimationDuration NS_AVAILABLE_IOS(9_0);

@end

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 151,511评论 1 330
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 64,495评论 1 273
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 101,595评论 0 225
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 42,558评论 0 190
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 50,715评论 3 270
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 39,672评论 1 192
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,112评论 2 291
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 29,837评论 0 181
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 33,417评论 0 228
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 29,928评论 2 232
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,316评论 1 242
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 27,773评论 2 234
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,253评论 3 220
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 25,827评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,440评论 0 180
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 34,523评论 2 249
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 34,583评论 2 249

推荐阅读更多精彩内容