Reputation: 1351
How do I detect when a certain view appears while the app is running? e.g. in a tab bar app let's say we have 2 bars "Results" and "Edit" - the app loads with results and there is nothing. Now, users goes to edit and makes some magic. Then, he presses the results bar again, and he will see the results. In other words, I need to pass the information from "edit" view controller to "results" view controller when the results bar is pressed. I hope I made this clear. Thanks in advance!
Upvotes: 0
Views: 497
Reputation: 89509
There's a few ways to approach this problem.
1) you could keep a handle (or pointer, or property) to the "Results" view controller from your "Edit" view controller and when you want to send data to "Results", that'll be easy to do (via a method or a delegate protocol).
2) you could register the "Results" view controller for notifications and then when you want to update it with any new data, populate your fields when the proper notification comes in. And over in your "Edit" view controller, post a notification with a dictionary and/or object that encapsulates the results you want to display.
And there's more!
Upvotes: 2