【问题标题】:Perform segue from tabbarcontroller in swift快速从 tabbarcontroller 执行 segue
【发布时间】:2017-12-13 03:46:36
【问题描述】:

我有一个带有 4 个选项卡的 TabBarController。 When the second tab is selected I would like to make an api call to get data & then, once the data returns, display the data in the destination view controller (let's call it SecondViewController).

我相信我应该做的是将 SecondViewController 连接到 TabBarController,并在情节提要中使用“显示”segue。但是,似乎我必须使用“relationship segue”将 TabBarController 连接到 SecondViewController 才能显示选项卡图标。所以我都连接好了。

选择第二个选项卡时,在返回必要的数据之前立即显示第二viewController。关于如何解决这个问题的任何想法?

我已经用谷歌搜索了几个小时,但没有找到任何有用的建议。我发现的一个有点相关的stackoverflow问题是Prepare for Segue

【问题讨论】:

    标签: iphone swift uitabbarcontroller uistoryboardsegue


    【解决方案1】:

    抱歉,iOS 无法满足您的需求。

    你可以做一件事一开始就把关系放到一个空白页上。当您从 API 获得响应时,您可以重置页面。您可以使用 SecondViewController 以编程方式替换空白页。

    您可以做一件事,最初将关系与没有数据的 SecondViewController 页面建立关系。当您从 API 获得响应时,您可以重置页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-06
      • 2018-11-08
      相关资源
      最近更新 更多