【问题标题】:add navigation bar, and tab bar to all pages将导航栏和标签栏添加到所有页面
【发布时间】:2016-04-22 02:15:45
【问题描述】:

我目前的应用状态是这样的: Current state of app

导航栏和标签栏都是图像。标签栏上有按钮。现在我在整个应用程序中都有相同的按钮和图像集。我是 iOS 的菜鸟。我希望使用一些内部功能,例如由 xcode 本身提供的工具栏/导航栏/标签栏,而不是使用单独的图像。我想要所有页面中的标签栏和导航栏。有没有办法将这些标签栏和导航栏添加到所有页面? 我也在使用一个超类,来继承所有的常用功能。

我使用 swift。

【问题讨论】:

    标签: ios iphone swift


    【解决方案1】:

    您必须将view controllernavigation controller 嵌入到您的根目录中,并且navigation controllertab bar controller 一起嵌入。

    要“嵌入”view controller,只需在storyboard 上选择您的根view controller,然后选择Editor -> Embed in -> Navigation Controller

    要“嵌入”您的navigation controller,只需在storyboard 上选择它并选择Editor -> Embed in -> Tab Bar Controller

    【讨论】:

    • 我现在这样做了。我的故事板是这样的:imgur.com/e1WjSVY 但是我无法在“评分最高”选项卡中添加任何导航项,就像收藏夹导航栏上写着“收藏夹”一样。
    • 删除navigation controller 并用navigation controller 每个view controller “嵌入”,所以每个view controller 都会有自己的navigation controller 然后你必须可以添加任何导航项.
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多