2016-03-09 50 views
0

我试图解决这个问题近两天!我还没有找到任何解决方案。reloadData的UITableView与动态单元高度不需要的滚动

我有动态单元格高度应该是一个实现代码如下,我使用此代码

tableView.rowHeight = UITableViewAutomaticDimension 
tableView.estimatedRowHeight = 300.0 

对于我的tableView我使用的是infinit scroll库加载动态高度更多的数据。

在某些情况下,我正在使用更新的数据重装我的tableview!当我调用reloadData()tableview向上或向下滚动时。修复了estimatedRowheight应该是高至少550.0

tableView.estimatedRowHeight = 550.0

当这个问题解决我与infinitscroll另一个问题,当我打电话self.tableView.finishInfiniteScroll()所述的tableView向上滚动(跳动的)

self.tableView.beginUpdates() 
self.tableView.insertRowsAtIndexPaths(indxesPath, withRowAnimation: UITableViewRowAnimation.Fade) 
self.tableView.endUpdates() 
self.tableView.finishInfiniteScroll() 

我正在使用AutoLayout!和我测试的的iOS 9.1

+0

你需要设置的内容了滚动 –

+0

偏移只知道,从哪儿来你得到价值550.0并且修理了Jerking Issue? :)它也拯救了我的一天。 –

回答

0

试试这个,不表给予高度和细胞的任何地方

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat 
{ 
    return UITableViewAutomaticDimension 
} 

func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat 
{ 
    return 44.0 
} 
相关问题