Showing posts with label UINavigationController. Show all posts
Showing posts with label UINavigationController. Show all posts

Thursday, 5 December 2013

Add UINavigationBar to modal UITableViewController

ViewController *vc = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:vc];
[self.navigationController presentModalViewController:navC animated:YES];
 
Now , you'll add UINavigation items over this viewcontroller
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"YOUR_IMAGE_NAME_WITH_EXTENSION"]];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStyleDone target:self action:nil];

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