Explorar el Código

Add convenience method for getting the network transaction for an index path in the history view controller.

Ryan Olson hace 11 años
padre
commit
11411a20b7
Se han modificado 1 ficheros con 12 adiciones y 7 borrados
  1. 12 7
      Classes/Network/FLEXNetworkHistoryTableViewController.m

+ 12 - 7
Classes/Network/FLEXNetworkHistoryTableViewController.m

@@ -95,13 +95,7 @@
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     FLEXNetworkTransactionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kFLEXNetworkTransactionCellIdentifier forIndexPath:indexPath];
-    FLEXNetworkTransaction *transaction = nil;
-    if (tableView == self.tableView) {
-        transaction = [self.networkTransactions objectAtIndex:indexPath.row];
-    } else if (tableView == self.searchController.searchResultsTableView) {
-        transaction = [self.filteredNetworkTransactions objectAtIndex:indexPath.row];
-    }
-    cell.transaction = transaction;
+    cell.transaction = [self transactionAtIndexPath:indexPath inTableView:tableView];
 
     if (indexPath.row % 2 == 0) {
         cell.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0];
@@ -112,6 +106,17 @@
     return cell;
 }
 
+- (FLEXNetworkTransaction *)transactionAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView
+{
+    FLEXNetworkTransaction *transaction = nil;
+    if (tableView == self.tableView) {
+        transaction = [self.networkTransactions objectAtIndex:indexPath.row];
+    } else if (tableView == self.searchController.searchResultsTableView) {
+        transaction = [self.filteredNetworkTransactions objectAtIndex:indexPath.row];
+    }
+    return transaction;
+}
+
 #pragma mark - Search display delegate
 
 - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString