我遇到了一个非常奇怪的问题,我可以设置 UITabBarController 的 moreNavigationController 的所有属性(除了 rightBarButtonItem 属性)。我猜这可能是因为与可定制 View Controller 属性相关的一些错误禁用了所有右栏按钮项目。有什么解决办法吗?
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
最佳答案
好的解决方案是使用 moreNavigationController 的委托(delegate)
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *) viewController animated:(BOOL)animated {
viewController.navigationItem.rightBarButtonItem = doneButton;
}
关于iphone - 无法设置UITabBarController的moreNavigationController的右键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5325827/