How to get navigation bar on ViewBased Application
H开发者_运维百科ow to add navigation bar on to ViewBased application [templet]
The following code will present a new navigation controller.
MyViewController *v = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
UINavigationController *t = [[UINavigationController alloc] initWithRootViewController:v];
[self presentModalViewController:t animated:true];
[t release];
[v release];
Otherwise, u can add the navigation bar to the nib file associated with the viewcontroller directly.
In your AppDelegate.m
-file, add this under applicationDidFinishLaunching
(or something like that).
UINavigationBar *navigationBar = [[UINavigationBar alloc] init];
[window addSubview:navigationBar];
精彩评论