![](/img/trans.png)
[英]Segue from ViewController to first tab of TabBarController
[英]How to switch from a ViewController back to the second tab of a TabBarController
我的應用程序有一個TabBarController,其中第二個Tab上有一個按鈕,按下該按鈕會將用戶帶到新的ViewController。 我想知道是否有可能從單擊按鈕后顯示的ViewController回到TabBarController的第二個選項卡。 現在,我的應用程序可以返回到TabBarController,但它只是從第一個選項卡而不是第二個選項卡顯示視圖。 目前,我僅從main.storyboard進行了segues設置,以便返回到TabBarController。
只需設置選定的索引:
tabBarController?.selectedIndex = 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.