更快速地从URL加载图像并将其显示在iPhone应用程序中 [英] Faster way to load an image from a URL and display it in an iPhone app

查看:70
本文介绍了更快速地从URL加载图像并将其显示在iPhone应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码在我的ImageView中显示图像:

I am using the following code to display an image in my ImageView:

   imgbackBG.image = [UIImage imageWithData:
                   [NSData dataWithContentsOfURL:
                    [NSURL URLWithString:[NSString stringWithFormat:@"http://%@",    [test.arrImagessplash objectAtIndex:[test.arrImages count]-4]]]]];

    4cing.com/mobile_app/uploads/pageicon/splash.png

问题是代码执行速度非常慢。有没有办法加载图像并更快地在ImageView中显示它?如果是这样,我该怎么做?

The problem is that the code executes very slowly. Is there a way to load the image and display it in the ImageView more quickly? If so, how can I do this?

推荐答案

从这里下载文件......

Download the Files from here.....

https://github.com/nicklockwood/AsyncImageView

并按以下方式使用:

AsyncImageView *asyncImageView = [[AsyncImageView alloc]initWithFrame:CGRectMake(30,32,100, 100)];   
[asyncImageView loadImageFromURL:[NSURL URLWithString:your url]];
[YourImageView addSubview:asyncImageView];
[asyncImageView release];

这篇关于更快速地从URL加载图像并将其显示在iPhone应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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