Просмотр исходного кода

Improve network history table view performance when lots of network activity is occurring.

This was showing up hot in the profile. The documentation for -[UITableView reloadRowsAtIndexPaths:withRowAnimation:] actually suggests what we’re doing here now for cases where you don’t need to make updates obvious to the user.
Ryan Olson лет назад: 11
Родитель
Сommit
6f2d811338
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      Classes/Network/FLEXNetworkHistoryTableViewController.m

+ 4 - 4
Classes/Network/FLEXNetworkHistoryTableViewController.m

@@ -229,10 +229,10 @@
     for (UITableView *tableView in tableViews) {
     for (UITableView *tableView in tableViews) {
         for (FLEXNetworkTransactionTableViewCell *cell in [tableView visibleCells]) {
         for (FLEXNetworkTransactionTableViewCell *cell in [tableView visibleCells]) {
             if ([cell.transaction isEqual:transaction]) {
             if ([cell.transaction isEqual:transaction]) {
-                NSIndexPath *indexPath = [tableView indexPathForCell:cell];
-                if (indexPath) {
-                    [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
-                }
+                // Using -[UITableView reloadRowsAtIndexPaths:withRowAnimation:] is overkill here and kicks off a lot of
+                // work that can make the table view somewhat unresponseive when lots of updates are streaming in.
+                // We just need to tell the cell that it needs to re-layout.
+                [cell setNeedsLayout];
                 break;
                 break;
             }
             }
         }
         }