1

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?

inexcitus
  • 2,471
  • 2
  • 26
  • 41

1 Answers1

1

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.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215