开发者

How to get navigation bar on ViewBased Application

开发者 https://www.devze.com 2023-03-23 12:56 出处:网络
H开发者_运维百科ow to add navigation bar on to ViewBased application [templet]The following code will present a new navigation controller.

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消