设为首页 加入收藏

TOP

【代码笔记】iOS-利用图片序列创建动态图片效果
2017-10-13 10:23:57 】 浏览:6705
Tags:代码 笔记 iOS- 利用 图片 序列 创建 动态 效果

一,效果图。

二,代码。

RootViewController.m

复制代码
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    //显示图片的UIImageView
    UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
    imageview.backgroundColor=[UIColor redColor];
    [self.view addSubview:imageview];
    
    //动画的实现
    NSMutableArray * images = [NSMutableArray arrayWithCapacity:6];
    for (int i = 1; i <= 6; i++)
    {
        NSString * imageName = [NSString stringWithFormat:@"%d.jpg",i];
        UIImage * image = [UIImage imageNamed:imageName];
        
        [images addObject:image];
    }
    imageview.animationImages = images;
    imageview.animationDuration = 0.3;
    [imageview startAnimating];

}
复制代码

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇iOS中的小知识点 下一篇【代码笔记】iOS-水波效果

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目