I have View A, when the user clicks a button I pop up View B. When the user dismisses View B, and we return to View A I would like to refresh a label on View A, but is there an event that I can use to detect that we have returned to View B? I know that ViewDidLoad doesn't fire again.
I'm confused about the views in your question, but you might look into the NSNotificationCenter
.
In this case, you would post an NSNotification
event when the user dismisses View B.
Views A and B can register with the notification center to listen for this dismissal notification, calling a selector (method) when this notification is heard.
In this method, you might update a label's state or do anything else that involves updating the application state.
Likewise, you might post a notification when View B is popped-up, and have other classes register for that notification type.
More information about NSNotificationCenter
is located on Apple's documentation site.
It sounds like you may be referring to UIViewControllers, rather than UIViews, correct? In that case, you can use -viewWillDisappear: (BOOL) animated and -viewDidDisappear: (BOOL) animated to determine when your viewController is-about-to-be/was-just-dismissed. These should be implemented on View B in your example. If you want to find out when View A is visible again, you can use -viewWillAppear: and -viewDidAppear.