Tuesday, 25 September 2012

Add NavigationBar on PresentModalViewController

UIViewController = YOUR_VIEW_CONTROLLER;
UIViewController = YOUR_VIEW_CONTROLLER;
 UIViewController *viewController=[[UIViewController alloc]initWithNibName:@"UIViewController" bundle:nil];
UINavigationController *navBarController=[[UINavigationController alloc]initWithRootViewController: viewController];
[self.navigationController presentModalViewController:navBarController animated:YES];
[navBarController release];
[UIViewController release];
if you want to add barbutton-items on this navBarController :
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:YOUR_BAR_SYSTEM_ITEM target:self action:@selector(YOUR_SELECTOR:)] autorelease];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:YOUR_BAR_SYSTEM_ITEM target:self action:@selector(YOUR_SELECTOR:)] autorelease];

No comments:

Post a Comment