当>时,beginUpdates / endUpdates挂起2000行

时间:2015-10-12 16:13:47

标签: ios swift uitableview autolayout

我有一个包含170,000多行的tableView,并注意到调用了

tableView.beginUpdates()
tableView.endUpdates()

将导致我的CPU使用率为100%并冻结我的应用程序。

要解决这个问题,我将整个tableView减少到最简单的一个,并注意到当我将numberOfRows更改为超过2000+时,应用程序会在beginUpdates / endUpdates上冻结越来越长。

我想也许这是因为autoLayout,所以我删除了所有约束并将我的heightAtRow设置为常量40.0,但它没有解决问题。

我的问题是,如果行被重用,为什么beginUpdates / endUpdates(请注意,我不是在这些调用之间改变任何东西,我只是要调用它来测试)需要这么长时间才能处理170,000行? / p>

我的cellForRow方法是空白的,我的故事板只有单元格的contentView:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("ProductDescriptionCell", forIndexPath: indexPath) as! ProductDescriptionTableViewCell
        return cell
    }

0 个答案:

没有答案
相关问题