当UITableView heightForRowAtIndexPath动态改变高度时 tableview向上滑动会jump 跳的问题

来源:互联网 发布:sql 相同字段数据合并 编辑:程序博客网 时间:2024/05/04 16:55

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 


因为向上滑动先启动 cellForRowAtIndexPath 然后才是heightForRowAtIndexPath 所以cell的高度会先改变  heightForRowAtIndexPath来不及执行 cell的高度就改变了所以来不及跳转


解决方案 :

应该在return cell; 之前设置cell的高度

在 

cellForRowAtIndexPath加上

self.rowHeight = [onePicGifTableViewCellheightCell];

就可以了
阅读全文
0 0
原创粉丝点击