gpt4 book ai didi

ios - TableView deleteRowsAtIndexPaths :withRowAnimation Very Slow

转载 作者:行者123 更新时间:2023-11-29 10:38:38 26 4
gpt4 key购买 nike

我有一个可能有几百行的表格,所有行的高度都不同。每当用户删除一行时,调用:

    [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];

执行时间很长(大约 2.5 秒)。

是否有替代调用此调用或任何加速它的方法?谢谢!

最佳答案

使用UITableView 的方法estimatedRowHeight 来加速。

Providing a nonnegative estimate of the height of rows can improve the performance of loading the table view. If the table contains variable height rows, it might be expensive to calculate all their heights when the table loads. Using estimation allows you to defer some of the cost of geometry calculation from load time to scrolling time.

在任何情况下,您都应该使用 Instruments 测量代码的哪些部分占用的时间最多。

关于ios - TableView deleteRowsAtIndexPaths :withRowAnimation Very Slow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25682820/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com