简体   繁体   中英

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.

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.

How can solve this by using popToViewController(vc, animated: true) and load tableView at a time?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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