【问题标题】:How to create a tab bar in addition to the nav bar除了导航栏,如何创建标签栏
【发布时间】:2014-04-19 05:12:42
【问题描述】:

我有一个 RMQ ruby​​ 运动应用程序。此外,我有一个带有 UINavigation 的屏幕(ProfileController)。即顶部有< Back <title> 导航。点击屏幕上的按钮,我想打开一个带有两个选项卡的新屏幕(HomeController,@ 987654325@)。但是在这个新屏幕上,我想保留我的导航,即< Back 应该将用户带回上一个屏幕。

对于标签,我使用 Promotion 来显示两个标签。要打开选项卡,我在单击按钮时执行此操作:open_tab_bar HomeScreen, HomeScreen2。这一切都很好,但是当标签HomeScreen 显示应用程序时,我失去了导航。

这是代码

class ProfileController < PM::Screen
...
  def show_tabs
    open_tab_bar HomeScreen, HomeScreen2
  end
...
end

class HomeScreen < PM::Screen
  title "Home"

  def will_appear
    @view_setup ||= set_up_view

    self.title = "One"
  end

  def set_up_view
    set_attributes self.view, {
      background_color: UIColor.whiteColor
    }

    set_tab_bar_item system_icon: UITabBarSystemItemFeatured

    true
  end

end


class HomeScreen2 < PM::Screen
  title "Home"

  def will_appear
    @view_setup ||= set_up_view

    self.title = "One"
  end

  def set_up_view
    set_attributes self.view, {
      background_color: UIColor.whiteColor
    }

    set_tab_bar_item system_icon: UITabBarSystemItemFeatured

    true
  end

end

如您所见,顶部没有导航

问题

有没有办法添加导航栈d

【问题讨论】:

    标签: ios rubymotion


    【解决方案1】:

    很遗憾,您无法使用库存的 UITabBar 做到这一点。正如 ProMotion 的文档所说,它将标签栏作为根视图控制器打开:

    https://github.com/clearsightstudio/ProMotion/wiki/API-Reference:-ProMotion::Tabs#open_tab_barscreens

    打开一个带有指定屏幕的 UITabBarController 作为当前应用的根视图控制器。 iOS 不允许将 UITabBar 作为子视图打开。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-03
      • 2019-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多