MBProgressHUD 与 ASIHTTPRequest
我正在尝试使用 MBProgressHUD 显示通过 ASINetworkQueue 下载的多个图像的下载进度。
我已将 hud 设置为网络队列的进度委托,并将 hud 的模式设置为 MBProgressHUDModeDeterminate。
我可以让HUD显示和隐藏,但我无法改变进度。在网络队列完成之前,HUD 不会重新绘制自身。
我可以看到 MBProgressHUD 的 drawRect 从未被调用,但我不知道为什么。
如果有人可以提供如何实现此目标的示例或伪代码,我将非常感激。
谢谢,
安德烈斯
I am trying to use MBProgressHUD to display a progress of download of multiple images which are downloaded via ASINetworkQueue.
I have set the hud as networkQueue's progress delegate and I have also set the mode of the hud to MBProgressHUDModeDeterminate.
I can make the hud display and hide, but I cannot change the progress. The hud just doesn't redraw itself until the networkQueue is complete.
I can see that MBProgressHUD's drawRect is never called but I don't know why.
I would be very grateful if anyone could provide a sample or pseudo code of how to achieve this.
Thanks,
Andrius
可能有两个可能的问题:
应用程序的主线程已被阻塞;您是否在主线程上调用“waitUntilAllOperationsAreFinished”或类似方法?
如果服务器未发送 Content-Length: 标头,ASIHTTPRequest 无法报告太多进度,因此这也可能是问题所在。
There are perhaps two likely issues:
The main thread of your application has been blocked; are you calling 'waitUntilAllOperationsAreFinished' on the main thread or similar?
ASIHTTPRequest can't report much in the way of progress if the server isn't sending Content-Length: headers, so this could also be the issue.