iOS some problems during download multiple images and update UIProgressView

£可爱£侵袭症+ 提交于 2019-12-13 05:26:40

问题


I have this 3 classes.

  • MyViewController.m (click to see code)
  • MySync.m (click to see code)
  • ImageDownload.m (click to see code)

When I download a image, I try to update the UIProgressView in my UIViewController, but the update are delayed, and I see a strange problem (see the blank space in attach image).

When all downloads are complete and execute the method "syncComplete" of "MyViewController", the method "dismissAlertView" is not triggered :S

I hope somebody can help me.

Thanks.


回答1:


Assuming that syncComplete is the one calling dismissAlertView, make sure iI is calling to the UI thread (main thread). Something like this if you use GCD:

dispatch_async (dispatch_get_main_queue (),  ^{
// call the dismissAlertView method here
}); 


来源:https://stackoverflow.com/questions/15037791/ios-some-problems-during-download-multiple-images-and-update-uiprogressview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!