在动画图像的UIImageView [英] Animate images in uiimageview

查看:131
本文介绍了在动画图像的UIImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从动画Web服务中的图像。我得到了code动画从bundle.How图像从URL数组装载图像

这code连接下面

 的UIImageView * animatedImageView = [[UIImageView的页头] initWithFrame:方法self.view.bounds];
animatedImageView.animationImages = [NSArray的arrayWithObjects:
                               [UIImage的imageNamed:@image1.gif],
                               [UIImage的imageNamed:@image2.gif],
                               [UIImage的imageNamed:@image3.gif],
                               [UIImage的imageNamed:@image4.gif],无]
animatedImageView.animationDuration = 1.0F;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating]
[self.view addSubview:animatedImageView];


解决方案

要从Web服务下载图像;

 的NSData *为imageData = [NSData的dataWithContentsOfURL:*从Web服务* URL];
 *的UIImage = imageOne [UIImage的imageWithData:为imageData];

从可能的Web服务下载的所有图像和创建像

数组

 的NSArray * imagesArray = [NSArray的arrayWithObjects:imageOne ...........,零]

和很少使用修改

 的UIImageView * animatedImageView = [[UIImageView的页头] initWithFrame:方法self.view.bounds];
animatedImageView.animationImages = imagesArray;
animatedImageView.animationDuration = 1.0F;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating]
[self.view addSubview:animatedImageView];

How to animate the images from web service. I got the code to animate the images from bundle.How to load the images from the url an array

That code is attached below

UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
animatedImageView.animationImages = [NSArray arrayWithObjects:    
                               [UIImage imageNamed:@"image1.gif"],
                               [UIImage imageNamed:@"image2.gif"],
                               [UIImage imageNamed:@"image3.gif"],
                               [UIImage imageNamed:@"image4.gif"], nil];
animatedImageView.animationDuration = 1.0f;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
[self.view addSubview: animatedImageView];

解决方案

To download images from webservice ;

NSData *imageData = [NSData dataWithContentsOfURL:"*Url from web service*"];
 UIImage *imageOne = [UIImage imageWithData:imageData];

likely download all images from web service and create an array like

NSArray *imagesArray = [NSArray arrayWithObjects:imageOne...........,nil];

and use with little modification

UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
animatedImageView.animationImages = imagesArray;
animatedImageView.animationDuration = 1.0f;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
[self.view addSubview: animatedImageView];

这篇关于在动画图像的UIImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆