Ash*_*hok 3 uitableview ios swift
我们可以UITableViewCell在不重新加载的情况下更改其中单击按钮的内容大小吗?当我做reloadData()或reloadCell() UITableView闪烁时,我想避免这种闪烁.
Mah*_*a Y 10
您应该使用beginUpdates()和endUpdates()来更改UITableViewCell的内容大小,在这种情况下,将为tableView中的每个单元调用heightForRowAtindexPath并更新TableviewCell的高度.对于iOS> 10,您应该更喜欢performBatchUpdates(_:completion :)而不是beginUpdates()和endUpdates().
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.tableView.beginUpdates()
self.tableView.endUpdates()
}
Run Code Online (Sandbox Code Playgroud)
欲获得更多信息
https://appengineer.in/2018/07/11/resize-uitableviewcell-size-without-fluctuation-and-jerk/
https://developer.apple.com/documentation/uikit/uitableview/1614908-beginupdates
| 归档时间: |
|
| 查看次数: |
531 次 |
| 最近记录: |