https://github.com/YouXianMing

UIImageView的animationImages动画

UIImageView的animationImages动画

UIImageView的animationImages,只有在做非常规动画的时候才有优势,比方说下图中左侧动画.如果用来做下图中的右侧动画,就是非常low的表现了.

效果(这是从凤凰新闻的ipa包中获取到的图片包数据):

//
//  ViewController.m
//  UIImageView
//
//  Created by YouXianMing on 15/1/31.
//  Copyright (c) 2015年 YouXianMing. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];

    // 初始化UIImageView
    UIImageView *imageViewOne = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 230 / 2.f, 230 / 2.f)];
    imageViewOne.center       = self.view.center;
    [self.view addSubview:imageViewOne];
    
    // 初始化图片数组
    NSMutableArray *imagesArray = [NSMutableArray new];
    for (int count = 1; count <= 10; count++) {
        NSString *imageName = [NSString stringWithFormat:@"loadingLogo_%02d", count];
        UIImage  *image     = [UIImage imageNamed:imageName];
        [imagesArray addObject:image];
    }

    for (int count = 10; count >= 1; count--) {
        NSString *imageName = [NSString stringWithFormat:@"loadingLogo_%02d", count];
        UIImage  *image     = [UIImage imageNamed:imageName];
        [imagesArray addObject:image];
    }

    // 设置动画
    imageViewOne.animationImages      = imagesArray;
    imageViewOne.animationDuration    = 2.f;
    imageViewOne.animationRepeatCount = 0;
    
    // 开始动画
    [imageViewOne startAnimating];
}

@end

 

posted @ 2015-01-31 23:04  YouXianMing  阅读(2706)  评论(0编辑  收藏  举报