Update UIProgressView in UICollectionViewCell for download file

后端 未结 2 1816
执念已碎
执念已碎 2021-01-20 15:44

I\'m trying to update the UIProgressView in UICollectionViewCell when I download a file, but sometime the progressView update and sometime doesn\'t update, and I can\'t unde

相关标签:
2条回答
  • 2021-01-20 15:55

    It might be about the thread issue. just try

    dispatch_async(dispatch_get_main_queue(), ^{
                UIProgressView *pgr = (UIProgressView *)[progress objectAtIndex:0];
                [pgr setProgress:[[progress objectAtIndex:1] floatValue]];
           });//end block
    

    try async or sync

    0 讨论(0)
  • 2021-01-20 16:00

    Create your customCell and display all Visible UIViews in it(init , add subview...). Than use custom method in cellForItemAtIndexPath to active(display) it. If you think about MVC, cellForItemAtIndexPath just for Controller, not View.

    In your case, bring all IBAction, loadLink and updateProgress to customCell and send parameter to active them, or you can create new protocol like CustomCellDelegate to communicate.

    Check for more information:

    Error setting text in collection view cell

    0 讨论(0)
提交回复
热议问题