开发者

iPhone UINavigationController bar buttons not showing

开发者 https://www.devze.com 2023-03-24 04:00 出处:网络
I am having an issue: I have a tab-bar based app. In MainWindow.xib for开发者_如何学C the tab that shows the nav controller it links to RootViewController.xib.

I am having an issue: I have a tab-bar based app. In MainWindow.xib for开发者_如何学C 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)];


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


If you init the navigation controller with...

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

Then you can set button with...

rootViewController.navigationItem.rightBarButtonItem = yourButton;
0

精彩评论

暂无评论...
验证码 换一张
取 消