I want to add back button on UINavigationController,I am trying Below Code :
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:source];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:photoController];
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
navController.modalPresentationStyle = UIModalPresentationFullScreen;
// UINavigationBar *my_bar;
//UINavigationItem *my_item=[[UINavigationItem alloc] initWithTitle:@"test"];
UIBarButtonItem* button = [[UIBarButtonItem alloc] initWithTitle: @"Back"
style: UIBarButtonItemStyleBordered
target: navController
action: @selector(onBack)];
//my_item.rightBarButtonItem = button;
[[navController navigationItem] setRightBarButtonItem:button];
self.title=@"Gallery";
[self presentModalViewController:navController animated:YES];
this code output is Below:
code does not add Back Button in UINavigationController.I am adding Code to Back button on UINavigationController,what's Wrong on my code...!
Please any one help me...!
Thanks..!
Try to add the UIBarButtonItem from the rootviewcontroller class (photoController) viewDidLoad method.