cocoaTouch/MasterViewController.m
changeset 3352 ac5d14a35482
parent 3335 2520ee7a5484
child 3357 3836a31879e7
equal deleted inserted replaced
3351:3fd3f116f2fc 3352:ac5d14a35482
   116 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   116 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   117     int newRow = [indexPath row];
   117     int newRow = [indexPath row];
   118     int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : 0;
   118     int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : 0;
   119     
   119     
   120     if (newRow != oldRow) {
   120     if (newRow != oldRow) {
       
   121         [self.tableView deselectRowAtIndexPath:lastIndexPath animated:YES];
   121         [detailViewController.navigationController popToRootViewControllerAnimated:NO];
   122         [detailViewController.navigationController popToRootViewControllerAnimated:NO];
   122         
   123         
   123         UITableViewController *nextController = [self.controllers objectAtIndex:[indexPath row]];
   124         UITableViewController *nextController = [self.controllers objectAtIndex:[indexPath row]];
   124         [detailViewController.navigationController pushViewController:nextController animated:YES];
   125         [detailViewController.navigationController pushViewController:nextController animated:NO];
   125         self.lastIndexPath = indexPath;
   126         self.lastIndexPath = indexPath;
   126         [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
   127         [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
   127     }
   128     }
   128     [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
       
   129 }
   129 }
   130 
   130 
   131 
   131 
   132 #pragma mark -
   132 #pragma mark -
   133 #pragma mark Memory management
   133 #pragma mark Memory management