gpt4 book ai didi

iphone - 无法设置 UITabBarController 的 moreNavigationController 的右键

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:34:32 25 4
gpt4 key购买 nike

我遇到了一个非常奇怪的问题,我可以设置 UITabBarController 的 moreNavigationController 的所有属性,但 rightBarButtonItem 属性除外。我猜这可能是因为与 customizedViewControllers 属性相关的一些错误禁用了所有右侧栏按钮项目。有什么解决办法吗?

    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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com