gpt4 book ai didi

ios - 使用分段控件在 UITabBarController 中以模态方式呈现导航 View Controller

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

过去几天我一直在网上搜索我的问题的解决方案,但是,我似乎找不到与我的问题类似的问题。我正在使用 TabBarController,在其中一个选项卡上,我在导航栏中有一个分段控件,我想用它在 View Controller 之间切换。问题是,当我呈现第二个 View Controller 时,它出现在 tabbarcontroller 上方。无论如何要将模态呈现的导航 Controller 保留在 tabbarcontroller 中?

Initial Controller

这是第一个 Controller 。

Presented Controller

这是我要展示的 Controller 。

最佳答案

好吧,除非我们看到一些代码,否则我们不能真正发表评论。但我认为您的问题可能与您的 View 层次结构有关。如果我要构建您正在尝试的内容,我会执行以下操作:

  1. 包含自定义导航栏 Controller 的 UITabbar Controller

  2. 自定义导航栏 Controller 将包含段 Controller 并定义了一个协议(protocol),以便在用户选择任一段时可以提醒代表。

  3. 导航栏的 Root View Controller 将是一个 View Controller ,充当您正在显示的两个屏幕( friend 和圈子屏幕)的 UIView 容器

  4. 这个 Root View Controller 将是自定义导航 Controller 的委托(delegate),以便它知道用户何时选择了一个片段。

  5. 当用户选择一个片段时, Root View Controller 将在容器中的 friend 和圈 subview Controller 之间切换。

要执行上述操作,请查看创建 UIViewController Containers 的文档和 working with delegates

希望对您有所帮助!

关于ios - 使用分段控件在 UITabBarController 中以模态方式呈现导航 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18393049/

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