1. 程式人生 > >iOS Tableview點擊cell 會往上跳

iOS Tableview點擊cell 會往上跳

mat for cti ref div html 偏差 clas 刷新

原因: UITableview有個估算行高功能,如果沒有設置tableView.estimatedRowHeight = 0,默認開啟,默認高度是44,也就是如果你實際行高和44偏差很大的話,每次reloadData就會先根據估算行高進行刷新然後再走heightForRow去獲取真正高度,就會視覺上就會產生跳一下的感覺,tableView.estimatedRowHeight = 0設置為0關閉這個功能就行了 解決辦法一:刷新單個cell 解決辦法二:
self.tableView.estimatedRowHeight = 0
self.tableView.estimatedSectionHeaderHeight 
= 0 self.tableView.estimatedSectionFooterHeight = 0

http://www.cocoachina.com/bbs/read.php?tid-1727023-page-1.html

iOS Tableview點擊cell 會往上跳