ios – 编辑按钮不显示在UITabBarController的MoreNavigationController中

ios – 编辑按钮不显示在UITabBarController的MoreNavigationController中,第1张

概述一个UITabBarController被推到堆栈上: let presenter = presentingViewController as! UINavigationControllerlet tabvc = UITabBarController()tabvc.viewControllers = vcstabvc.customizableViewControllers = vcspre 一个UITabbarController被推到堆栈上:
let presenter = presentingVIEwController as! UINavigationControllerlet tabvc = UITabbarController()tabvc.vIEwControllers = vcstabvc.customizableVIEwControllers = vcspresenter.pushVIEwController(tabvc,animated: true)

一旦呈现,更多的标签按钮正确显示,但编辑按钮重新排列标签栏不会.根据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.

我的猜测是,导航控制器中的标签栏不快乐.有关将编辑按钮重新启动的任何想法?

解决方法 你可以同时拥有一个UINavigationController和一个UITabbarController;使用Storyboard可以更好地了解问题,任何这些解决方案都可以正常工作:

>使用UITabbarController作为初始视图控制器
>使用presentVIEwController而不是pushVIEwController
>使用模态故事板segue执行模态演示
>动态地切换rootVIEwController

初始视图控制器设计

Tab bar控制器为初始VIEw Controller时,编辑按钮正常显示.

推送设计

另一个导航控制器是初始视图控制器,使用5个自适应Action Segue之一:

>显示
>自定义

– >没有编辑按钮,因为它与父级UItableVIEwController直接冲突.

>显示详细信息
>现在模态
> Popover演示

– >编辑按钮按预期显示.

程序模态

使用问题中提供的确切代码,更改最后一行:

let presenter = presentingVIEwController as! UINavigationControllerlet tabvc = UITabbarController()tabvc.vIEwControllers = vcstabvc.customizableVIEwControllers = vcspresenter.presentVIEwController(tabvc,animated: true,completion: nil)

故事板模态

与故事板主题保持一致,创建正确类型的段落,分配一个标识符(即PresentModallySegue),并且上述5行成为这一行:

self.performSegueWithIDentifIEr("presentModallySegue",sender: self)

3.根交换

更为激烈的解决方案是在窗口级别切换根视图控制器:

let tabvc = UITabbarController()tabvc.vIEwControllers = vcstabvc.customizableVIEwControllers = vcsself.vIEw.window!.rootVIEwController = tabvc

结论

或者更改您的设计以采用Tab bar Controller作为初始视图控制器,或者以模态方式呈现Tab bar Controller.

总结

以上是内存溢出为你收集整理的ios – 编辑按钮不显示在UITabBarController的MoreNavigationController中全部内容,希望文章能够帮你解决ios – 编辑按钮不显示在UITabBarController的MoreNavigationController中所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1097181.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存