UITableViewCell content flickers while reloading cells individually

前端 未结 5 1198
余生分开走
余生分开走 2021-02-08 13:25

I have a table view linked to a NSFetchedResultController (i.e. loading data and also tracking changes to data is bound to the FRC)

I\'m not using Auto

5条回答
  •  庸人自扰
    2021-02-08 13:53

    In swift am using this and it decreases the flickering

    let visibleIndexs = self.ContentTableview.indexPathsForVisibleRows! as NSArray
            print(visibleIndexs)
            for indx in visibleIndexs {
                if self.imgDownloadedIndexs!.containsObject(indx) {
                      UIView.setAnimationsEnabled(false)
                    self.ContentTableview.beginUpdates()
                    self.ContentTableview.reloadRowsAtIndexPaths([indx as! NSIndexPath], withRowAnimation:.None)
                    self.ContentTableview.endUpdates()
                     UIView.setAnimationsEnabled(true)
                    self.imgDownloadedIndexs?.removeObject(indx)
    
                }
    

提交回复
热议问题