[英]Pop to next viewController in ios
我使用了這段代碼:
self.navigationController?.popToViewController(vc, animated: true)
通過使用它,它會彈出查看 controller 但 tableView 一次沒有加載,我需要 go 返回並再次出現,然后它正在加載。
這段代碼:
let vc = self.storyboard?.instantiateViewController(withIdentifier: "DiscountViewController") as! DiscountViewController
self.navigationController?.pushViewController(vc , animated: true)
通過使用此代碼,我彈出查看 controller,同時加載tableView
,但問題是,由於我們正在推送 viewController,它會返回兩三個。
如何通過使用popToViewController(vc, animated: true)
並一次加載 tableView 來解決這個問題?
最初這段代碼
self.navigationController?.popToViewController(vc, animated: true)
已經奏效了。 無論我在嘗試什么,我都無法在使用 popViewController 時彈出視圖 controller 和 reload() tableView。
如何解決這個問題?
如果您要彈回到之前顯示的視圖 controller,那么您可以通過在DiscountViewController
的viewWillAppear
function 中執行reloadData
來重新加載您的tableView
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.