I programmatically created some UINavigationControllers and added them to the UITabBarController. Everything seems to be working fine, but I wanted to add a cancel button to the navigation controller, but it never appears. I tried several ways, but I canβt influence the display of navigation elements in any way, and I used several examples from here and other sites, but nothing happens.
MyTableViewController *mtvc = [[MyTableViewController alloc] init]; UINavigationController *myNavController = [[[UINavigationController alloc] initWithRootViewController:mtvc] autorelease]; myNavController.navigationBar.barStyle = UIBarStyleBlackOpaque;
I also tried adding a button this way
[myNavController.navigationItem setLeftBarButtonItem:closeButton animated:NO];
I started to get upset, so I also tried some other things to see if I can influence anything, but to no avail
myNavController.title = @"test"; // does nothing
I tried to do this before and after the navigation controllers were added to the UITabBarController, and this did not help. I also tried rightBarButtonItem and tried to use initWithTitle: instead of initWithBarButtonSystemItem.
Will someone please light me up? Itβs clear that I am doing it wrong.
digarok
source share