1

I am having an issue: I have a tab-bar based app. In MainWindow.xib for the tab that shows the nav controller it links to RootViewController.xib. in RootViewController.xib I have created a navigation controller and have added a table view. in RootViewController in viewDidLoad i have [self.view addSubview:navController.view];. The tableview and navigation controller work well for navigation. pressing a cell pushes the controller, and bar buttons work in the pushed controller. But when I use self.navController.navigationItem.rightBarButtonItem = barButton; nothing shows up at all. also changing self.navController.navigationItem to self..navigationItem ect.. doesn't help. What do you think the problem could be? I appreciate every answer. fyi the barbuttonitem is setup with:

UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"Help" style:UIBarButtonItemStylePlain target:self action:@selector(help)];
user57368
  • 5,675
  • 28
  • 39
baharini
  • 217
  • 2
  • 11

2 Answers2

0

If u want to use both controller navigation and tab bar controller the u check the sample code of apple documentation. In which both function are use so i given link below.

UIcatalogue

ram
  • 1,193
  • 1
  • 15
  • 27
0

If you init the navigation controller with...

navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];

Then you can set button with...

rootViewController.navigationItem.rightBarButtonItem = yourButton;
Khomsan
  • 543
  • 5
  • 5