iphone - 无法设置 UITabBarController 的 moreNavigationController 的右键
<p><p>我遇到了一个非常奇怪的问题,我可以设置 UITabBarController 的 moreNavigationController 的所有属性,但 rightBarButtonItem 属性除外。我猜这可能是因为一些与可定制的ViewControllers 属性相关的错误禁用了所有右栏按钮项。任何想法如何解决?</p>
<pre><code> UIBarButtonItem *doneButton = [
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
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>好的解决方案是使用 moreNavigationController 的委托(delegate)</p>
<pre><code>- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *) viewController animated:(BOOL)animated {
viewController.navigationItem.rightBarButtonItem = doneButton;
}
</code></pre></p>
<p style="font-size: 20px;">关于iphone - 无法设置 UITabBarController 的 moreNavigationController 的右键,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/5325827/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/5325827/
</a>
</p>
页:
[1]