2017-06-05 133 views
0

我的應用程序有一個TabBarController,其中第二個Tab上有一個按鈕,按下該按鈕會將用戶帶到一個新的ViewController中。我想知道是否可以從點擊返回到TabBarController的第二個選項卡之後顯示的ViewController中移動。現在我的應用程序能夠返回到TabBarController,但它只是從第一個選項卡而不是第二個選項卡顯示視圖。目前,我只是從main.storyboard安裝segues,以便返回到TabBarController。如何從ViewController切換回TabBarController的第二個選項卡

+0

你能否提供一些代碼/屏幕捕捉你的問題?因爲當你點擊一個「TabBarController」按鈕時,使用segues會自動選擇按鈕。 –

回答

0

只需設置所選的索引:

tabBarController?.selectedIndex = 1 
相關問題