I have two view controller A & B.On ViewController
A i am displaying data from server.I have nav button Update to go to ViewController
B.On B i can update the data which was shown on ViewController
B.Now when data is updated on server i show an alert 'Update Success' on click of Ok i go to previous ViewController
.But i don't see the updated data because i removed the ViewController
B from stack but A is not reloded.
Code for going back to ViewController A
[self.navigationController popViewControllerAnimated:YES];
I assume you are sending a web call from viewDidLoad()
. So in order to update your viewController A Add your web call method in viewWillAppear()
The state of your "data" on view controller A has not changed and you need to refresh it. If you're fetching data for view controller A within -viewDidLoad
, try moving it to a different life cycle method like -viewWillAppear
.
Remember, -viewDidLoad
gets called only when the view controller loads which happens once, however -viewWillAppear
gets called before it appears which will happen often if you're hopping back and forth between views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With