I do not want animation in the begin updates, end updates block for uitableview?

前端 未结 6 1161
执念已碎
执念已碎 2020-12-22 22:43

I have a UITableView that is using a custom table cell and each cell has a UIWebView.

Because UIWebView took along time to load, i want to avoid reloading them at al

6条回答
  •  轮回少年
    2020-12-22 23:11

    working on my project, but not a common solution.

    let loc = tableView.contentOffset
    UIView.performWithoutAnimation {
    
        tableView.reloadData()
    
        tableView.layoutIfNeeded()
        tableView.beginUpdates()
        tableView.endUpdates()
    
        tableView.layer.removeAllAnimations()
    }
    tableView.setContentOffset(loc, animated: true)//animation true may perform better
    

提交回复
热议问题