Vous n'avez pas de contrôleur de navigation dans votre application. Vous devez en créer un. Quelque chose comme:
Dans votre appDelegate, créez une variable d'instance UINavigationController, puis utilisez votre viewController existant en tant que rootViewController du contrôleur de navigation.
par exemple. en code pur en utilisant un UITableViewController (vous pouvez aussi utiliser xibs, ce que votre application template fait probablement).
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Create root view and navigation controller
UITableViewController *rootViewController = [[[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped] autorelease];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:rootViewController] autorelease];
// Not necessary if you're using xibs
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Add the nav controller's root view to the window
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
return YES;
}
Ensuite, vous pouvez pousser/afficher de nouvelles vues de la façon dont vous essayez.
Merci Ryan, le chaînon manquant était - encore une fois - ne pas penser à l'évidence ... mettre un IBOutlet pour connecter le contrôleur de navigation. – iFloh
Ah. Ça va le faire. :) –