利用SDWebImage 异步加载图片的话,怎么跟踪进度?
有人说,“- (void)connection:(NSURLConnection *)aConnection didReceiveData:(NSData *)data 的函数里面
把data的长度读出来。”
利用这个方法,可以获得下载的数据的大小?
但是怎么委托给这个函数呢?在线等,急阿!!! --------------------编程问答-------------------- 你要用一个库就要好好地研究一下其功能,这里面是有相当多的下载方法的。
在它的UIImageView+WebCache.h这个扩展里,仔细看一下下面这个方法:
--------------------编程问答-------------------- 谢谢1喽。研究研究。 --------------------编程问答-------------------- 用第三方的库还是具体看看再使用吧...... --------------------编程问答-------------------- 加油lz~
/**
* Set the imageView `image` with an `url`, placeholder and custom options.
*
* The downloand is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
* @param progressBlock A block called while image is downloading
* @param completedBlock A block called when operation has been completed. This block as no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache of from the network.
*/
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock;
补充:移动开发 , iPhone