我在uinavigationcontroller
(aap的rootviewcontroller)上添加了subview
作为uiviewcontroller
,并且此视图控制器是subview
作为rootviewcontroller
自我。窗口。
在Appdelegate中我使用:
self.window.rootViewController = self.rootVC;
并在viewdidload
RootViewController
我写道:
[self.navVC.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
[self.navVC.navigationController.navigationBar setTranslucent:YES];
self.navVC.navigationController.navigationBarHidden = NO;
[app.rootVC.view addSubview:self.navVC.view];
self.navVC.delegate = self;
此处显示navigationbar
,但我无法在导航栏上显示uibarbutton
个项目。示例代码:
leftBtn = [[UIBarButtonItem alloc] initWithTitle:@"Left" style:UIBar
flxBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBa
rightBtn1 = [[UIBarButtonItem alloc] initWithTitle:@"Right" style:UIBar
rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"Right" style:UIBar
[self.navVC.navigationItem setLeftBarButtonItem:leftBtn];
[self.navVC.navigationItem setRightBarButtonItems:@[rightbtn1,rightbtn,flxBtn]];
有人可以帮助我解决我的问题。如何更改navigationbar
的外观以及如何显示uibarbutton
项?
答案 0 :(得分:0)
您只需要更改
即可[self.navVC.navigationItem setRightBarButtonItems:@[rightbtn1,rightbtn,flxBtn]];
到
[self.navigationItem setRightBarButtonItems:@[rightbtn1,rightbtn,flxBtn]];
和
[self.navVC.navigationItem setLeftBarButtonItem:leftBtn];
到
[self.navigationItem setLeftBarButtonItem:leftBtn];`