![](/img/trans.png)
[英]How can I go back to the first viewController from the third viewController
[英]How to go back to the first ViewController?
我有幾種看法。 下面是它的樣子: 第一個視圖是 StartViewController(箭頭),它打開 TabBarController,它是另外兩個視圖的所有者 - FavoriteViewController 和 MapViewController。 如何關閉所有這些和 go 回到 StartViewController? 這應該像從第一個視圖啟動應用程序一樣工作。 我發現了類似的問題,但不幸的是它不起作用。 go如何以正確的方式回到初始ViewController?
1.首先通過self.CurrentVC.dismiss(animated: true, completion: nil)
關閉你當前的 viewController
2.然后,呈現/顯示你的第一個或初始 viewController present(firstVC,animated: true,completion: nil)
這里CurrentVC是您當前 viewController 的名稱,而firstVC將是您要顯示的第一個 viewController 的名稱。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.