本文介绍了编辑按钮未显示在UITabBarController的MoreNavigationController中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 UITabBarController 正被推入堆栈: let presenter = presentViewController as! UINavigationController let tabvc = UITabBarController() tabvc.viewControllers = vcs tabvc.customizableViewControllers = vcs presenter.pushViewController(tabvc,animated:true) 一旦显示,正确显示更多标签按钮,但重新排列标签栏的编辑按钮不会。根据有关MoreNavigationController的 推送设计 另一个导航控制器 初始视图控制器,使用其中一个自适应动作Segue: 显示 自定义 - >否修改按钮,因为它与父 UITableViewController 。 显示详细信息 目前模仿 Popover演示文稿 - > 编辑按钮显示为预期。 代码 1。程序模式 使用问题中提供的确切代码,更改最后一行: 让presenter = presentViewController为! UINavigationController let tabvc = UITabBarController() tabvc.viewControllers = vcs tabvc.customizableViewControllers = vcs presenter.presentViewController(tabvc,animated:true,completion:nil) 2。故事板模态 保持 Storyboard 主题,创建一个正确类型的segue,分配一个标识符(即 presentModallySegue )和上面的5行成为单行: self.performSegueWithIdentifier(presentModallySegue,发件人:self) 3。 root交换 更激烈的解决方案是在窗口级别交换根视图控制器: let tabvc = UITabBarController() tabvc.viewControllers = vcs tabvc.customizableViewControllers = vcs self.view.window!.rootViewController = tabvc 结论 更改设计以采用标签栏控制器作为初始视图控制器,或显示标签栏控制器模态。 A UITabBarController is being pushed onto the stack: let presenter = presentingViewController as! UINavigationControllerlet tabvc = UITabBarController()tabvc.viewControllers = vcstabvc.customizableViewControllers = vcspresenter.pushViewController(tabvc, animated: true)Once presented the more tab button correctly shows, but the edit button to rearrange the tab bars does not. According to the docs on the MoreNavigationController: The interface for the standard More item includes an Edit button that allows the user to reconfigure the tab bar. By default, the user is allowed to rearrange all items on the tab bar. If you do not want the user to modify some items, though, you can remove the appropriate view controllers from the array in the customizableViewControllers property.My guess is that the tab bar is not happy being in a navigation controller. Any ideas on bringing the edit button back? 解决方案 You can have both a UINavigationController and a UITabBarController ; using Storyboard helps understand the issue better, any of these solutions will work:Start out with a UITabBarController as initial view controllerUse presentViewController instead of pushViewControllerUse a modal Storyboard segue to perform a modal presentationSwap out the rootViewController dynamicallyInitial View Controller DesignWhen the Tab Bar Controller is initial View Controller, the Edit button is displayed normally.Pushed DesignAnother Navigation Controller is initial View Controller, using one of 5 adaptive Action Segue:ShowCustom-> No Edit button, since it is in direct conflict with the parent UITableViewController.Show DetailPresent ModallyPopover Presentation-> Edit button displayed as expected.Code1. Program ModalUsing the exact code presented in the question, change the last line:let presenter = presentingViewController as! UINavigationControllerlet tabvc = UITabBarController()tabvc.viewControllers = vcstabvc.customizableViewControllers = vcspresenter.presentViewController(tabvc, animated: true, completion: nil)2. Storyboard Modalkeeping with the Storyboard theme, create a segue of the correct type, assign an identifier (i.e. presentModallySegue) and the 5 lines above become this single line:self.performSegueWithIdentifier("presentModallySegue", sender: self)3. root SwapA more drastic solution involves swapping out the root view controller at the window level:let tabvc = UITabBarController()tabvc.viewControllers = vcstabvc.customizableViewControllers = vcsself.view.window!.rootViewController = tabvcConclusionEither change your design to adopt the Tab Bar Controller as the initial View Controller, or present the Tab Bar Controller modally. 这篇关于编辑按钮未显示在UITabBarController的MoreNavigationController中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-14 13:19