//
// LoadImageView.h
// WisdomShope
//
// Created by mac on 15/12/26.
// Copyright (c) 2015年 ZY. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LoadImageView : UIImageView
//开始动画
- (void)startImageAnimation:(NSString *)imgName Count:(int)count;
//停止动画
- (void)stopImageAnimation;
//清除动画
- (void)clear;
@end
//
// LoadImageView.m
// WisdomShope
//
// Created by mac on 15/12/26.
// Copyright (c) 2015年 ZY. All rights reserved.
//
#import "LoadImageView.h"
@implementation LoadImageView
- (id)initWithFrame:(CGRect)frame{
if(self = [super initWithFrame:frame]){
}
return self;
}
- (void)startImageAnimation:(NSString *)imgName Count:(int)count{
NSMutableArray* a1=[[NSMutableArray alloc]init];
NSString* a2;
for (int i = 1; i <= count; i++) {
a2=[NSString stringWithFormat:@"%@%d",imgName,i];
UIImage* im1=[UIImage imageNamed:a2];
[a1 addObject:im1];
}
self.animationImages=a1;
self.animationDuration= .5;
self.animationRepeatCount=0;
[self startAnimating];
}
- (void)stopImageAnimation{
[self stopAnimating];
}
- (void)clear{
self.animationImages=nil;
[self removeFromSuperview];
}
@end