6.4 View-Controller auf den Stack schieben

Als Nächstes müssen wir die eigentliche Navigation durchführen. Dazu muss nur die tableView:didSelectRowAtIndexPath: implementiert und ein neuer View-Controller auf den Stack des Navigations-Controller geschoben werden. So sieht der Code dazu aus:

Navigation/DVDCase/Classes/RootViewController.m

- (void)tableView:(UITableView *)tableView
 didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if(0 == indexPath.row) {
      self.cabinetController.key = @"home";
      self.cabinetController.title = @"Zuhause";
   }  else {
      self.cabinetController.key = @"work";
      self.cabinetController.title = @"Arbeit";
   }
   [self.navigationController pushViewController:self.cabinetController
                                       animated:YES];
}

Wir haben den cabinetController noch nicht ...

Get Entwickeln mit dem iPhone SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.