ios - Tableview reloadRowsAtIndexPaths 获得 50% CPU 内存?

标签 ios iphone uitableview uiviewanimation nsindexpath

我有一个问题,我有一个 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/

相关文章:

ios - 如何使用后退按钮返回到 First ViewController?

iphone - iOS 会在后台杀死应用程序吗?

iphone - 如何在attachmentView/disclosure区域中创建带有“信息符号”的UITableViewCell? (例如iTunes Connect应用)

ios - UIImagePickerController 导致重复

ios - iOS印度的任何网上银行SDK或api

iphone - UITableView 的单元格在不可见时释放

ios - 如何使用 Objective C 获取 Tableview 选择的单元格 UILabels 值?

ios - 场景的子元素发布速度不够快?

ios - Swift:表格单元格出现一秒钟然后消失

ios - AQGridView EXC_BAD_ACCESS _basicHitTest :withEvent: