首页 > 其他 > 详细

封装出来的小动画,视图正在加载时的动画

时间:2015-12-28 20:32:27      阅读:263      评论:0      收藏:0      [点我收藏+]
//
//  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

 

封装出来的小动画,视图正在加载时的动画

原文:http://www.cnblogs.com/zxh-iOS/p/5083603.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!