![](/img/trans.png)
[英]swift - how can i check if a specific viewController is the previous viewController
[英]Swift 3 : How can I go to the previous ViewController and reload it?
我正在嘗試返回上一個視圖控制器,當我返回此頁面時,我需要重新加載視圖控制器。 我在A視圖控制器中使用了viewWillAppaer,但是當我在B視圖控制器中調用popViewController
時,它不起作用。
我在B viewController中使用了這段代碼:
self.navigationController?.popViewController(animated: true)
您確定要在NavigationController
上顯示ViewControllers
嗎? 有什么能發生的事情是你呈現ViewController
上的頂部ViewController
一個為此解雇了,你就會需要調用dismiss(animated: true, completion: nil)
上ViewController
B.
https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss
NavigationController指南: https : //developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/ImplementNavigation.html
如果要彈出導航控制器,則需要確保首先將導航控制器推入導航堆棧。 否則,您可以使用
present(UIViewController)
dismiss(UIViewController)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.