iOS中UIImageView帧动画相关属性和方法

@property(nonatomic,copy)NSArray *animationImages;

需要播放的序列图片数组(里面都是UIImage对象,会按顺序显示里面的图片)

@property(nonatomic)NSTimeInterval animationDuration;

帧动画的持续时间

@property(nonatomic)NSInteger animationRepeatCount;

帧动画的执行次数(默认是无限循环)

- (void)startAnimating;

开始执行动画

- (void)stopAnimating;

停止执行帧动画

- (BOOL)isAnimating;

判断是否正在执行动画

UIImage的两种加载方式

方式1:有缓存(图片所占用的内存一直停留在程序中)

>+ (UIImage *)imageNamed:(NSString *)name;

其中name时图片的文件名

方式2:无缓存(图片所占用的内存会在一些特定的操作后背清除)

> + (UIImage *)imageWithContentOfFile:(NSString *)path;

> - (id)initWithContentsOfFile:(NSSString *)path;

其中path是图片的全路径

ps:全路径有NSBundle 获取

原文地址:https://www.cnblogs.com/YTzZ/p/4684570.html