Pal*_*dis 2 iphone objective-c ios
我有一个非常奇怪的问题,我可以设置UITabBarController的moreNavigationController的所有属性,除了rightBarButtonItem属性.我猜这可能是因为与customizableViewControllers属性相关的一些错误禁用了所有正确的栏按钮项.任何想法如何解决?
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(popViewController)];
self.customizableViewControllers = nil;
self.moreNavigationController.navigationBar.barStyle = UIBarStyleBlack;
self.moreNavigationController.topViewController.navigationItem.title = @"test"; //this works
self.moreNavigationController.topViewController.navigationItem.leftBarButtonItem = doneButton; // this works
self.moreNavigationController.topViewController.navigationItem.rightBarButtonItem = doneButton; // this doesn't
Run Code Online (Sandbox Code Playgroud)
好的解决方案是使用moreNavigationController的委托
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *) viewController animated:(BOOL)animated {
viewController.navigationItem.rightBarButtonItem = doneButton;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2009 次 |
| 最近记录: |