没有任何理由,为什么我们不使用的UIImageView的子类? [英] Is there any reason why we don't use subclasses of UIImageView?

查看:112
本文介绍了没有任何理由,为什么我们不使用的UIImageView的子类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在试图创建的UIImageView的子类,以使其从服务器下载它的形象异步)

I'm currently trying to create a subclass of UIImageView in order to make it download its image from server asynchronously ;)

我试着自己做,但我没有去很远,但:D

I tried to do it by myself but I haven't gone very far yet :D

反正我环顾四周这里,发现这一点:

Anyway, I looked around here and found this :

AsyncImageDownload

我有一个看code和弹簧想到的第一个是:为什么继承一个UIView,而不是一个UIImageView

I had a look at the code and the first which springs to mind is : why subclassing a UIView and not a UIImageView ?!?

有什么想法?

干杯队友,

高堤耶。

推荐答案

这是UIView的子类的原因是,你应该,例如,显示UIActivityIndi​​cator当图像被下载。他们没有在他们的例子说明这一点,但我已经使用这个code和真的很不错。另外,也要看看这个职位,你会发现更多的code的例子,也包括一些缓存和不错的东西的意见。

The reason it is subclassing UIView is so that you should, for example, display a UIActivityIndicator while the image is being downloaded. They do not show this in their example but I have used this code and it is really good. Also look at the comments for this post you will find more code examples, also including some caching and nice stuff.

看看韦恩 Cochra的评论。他YellowJacket.zip code是非常好的。

Take a look at Wayne Cochra's comment. His YellowJacket.zip code is very nice.

这篇关于没有任何理由,为什么我们不使用的UIImageView的子类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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