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


目录
相关文章
UIImageView加上圆角
UIImageView加上圆角
40 0
UIImageView 图片自适应大小
UIImageView 图片自适应大小
106 0
|
UED 缓存 异构计算
UIImageView添加圆角的几种方法
喜欢我的可以关注收藏我的个人博客:RobberJJ 创建一个UIImageView对象: UIImageView * poImgView = [[UIImageView alloc] init]; 第一种方法 poImgView.
943 0