iPhone UINavigationController 栏按钮不显示
我遇到一个问题:我有一个基于选项卡栏的应用程序。在 MainWindow.xib 中,显示导航控制器的选项卡链接到 RootViewController.xib。 在 RootViewController.xib 中,我创建了一个导航控制器并添加了一个表视图。 在 viewDidLoad 的 RootViewController 中我有 [self.view addSubview:navController.view];。 表格视图和导航控制器非常适合导航。按下单元格会推动控制器,条形按钮会在被推动的控制器中工作。 但是当我使用 self.navController.navigationItem.rightBarButtonItem = barButton; 时,根本没有显示任何内容。还将 self.navController.navigationItem 更改为 self..navigationItem 等..没有帮助。您认为问题可能出在哪里?我很感激每一个答案。 仅供参考,barbuttonitem 设置为:
UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"Help" style:UIBarButtonItemStylePlain target:self action:@selector(help)];
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)];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想同时使用控制器导航和标签栏控制器,请检查苹果文档的示例代码。其中使用了这两个功能,所以我在下面给出了链接。
UIcatalogue
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...
Then you can set button with...