我有一个问题,我有一个 UITableViewController,当 View 出现时,我会异步执行一些计算,这应该会导致表中特定行的更新。
在 cellStartEditing 函数中,我计算需要更新的必要行,如下所示:
-(void) cellStartEditing:(templateRow *) row{
int Cellowid= row.rowId;
[arrQuestions removeObjectAtIndex:CellRowid];
[arrQuestions insertObject:row atIndex:CellRowid];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow: inSection:0];
[tvQuestion reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
那时 reloadRowsAtIndexPaths 动画获得 50% 的 CPU 内存?
最佳答案
在重新加载行之前通知 TableView 更新,如下所示:
[tvQuestion beginUpdates];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow: inSection:0];
[tvQuestion reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone]
[tvQuestion endUpdates];
关于ios - Tableview reloadRowsAtIndexPaths 获得 50% CPU 内存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29887585/