简体   繁体   English

弹出到 ios 中的下一个 viewController

[英]Pop to next viewController in ios

I used this code:我使用了这段代码:

self.navigationController?.popToViewController(vc, animated: true)

By using this it is poping to view controller but tableView is not loading at a time,i need to go back and come again then it is loading.通过使用它,它会弹出查看 controller 但 tableView 一次没有加载,我需要 go 返回并再次出现,然后它正在加载。

This code:这段代码:

let vc = self.storyboard?.instantiateViewController(withIdentifier: "DiscountViewController") as! DiscountViewController
self.navigationController?.pushViewController(vc , animated: true)

By using this code i'm popping to view controller,also loading tableView at a time, but the problem is, that it is going two or three to return back because we are pushing the viewController.通过使用此代码,我弹出查看 controller,同时加载tableView ,但问题是,由于我们正在推送 viewController,它会返回两三个。

How can solve this by using popToViewController(vc, animated: true) and load tableView at a time?如何通过使用popToViewController(vc, animated: true)并一次加载 tableView 来解决这个问题?

Initially this code最初这段代码

self.navigationController?.popToViewController(vc, animated: true)

has worked.已经奏效了。 Whatever I'm trying also I'm not able to pop view controller and reload() tableView when popViewController is used.无论我在尝试什么,我都无法在使用 popViewController 时弹出视图 controller 和 reload() tableView。

How to solve this?如何解决这个问题?

If you are popping back to a previously displayed view controller, then you can reload your tableView by doing reloadData in that DiscountViewController 's viewWillAppear function.如果您要弹回到之前显示的视图 controller,那么您可以通过在DiscountViewControllerviewWillAppear function 中执行reloadData来重新加载您的tableView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM