update
Everything in this answer is old news - since XCode 4.5 we can use unwind segues to get back to any previous viewController and trigger an unwind method in that controller. (thanks @rdelmar)
What are Unwind segues for and how do you use them?
the old way/code way.. which ideally involves delegates to get specific methods implemented
When a class dismisses itself, you can't grab it because it is ... dismissed. You need to have a hold of it before it is dismissed, and then know about the dismissing.
Elaborating on this a little, classes don't usually dismiss themselves, their owning classes do the dismissing. The obfuscating method here could be the UIViewController method:
- (void) dismissViewControllerAnimated:
which is a shorthand for
- (void) [[self presentingViewController] dismissViewControllerAnimated:completion:nil]
The presenting viewController has a property presentedViewController
which holds on to that dismissed object - until it is dismissed. When the presentingViewController dismisses, it resets it's presentedViewController
property to nil. But you always have the option of copying that reference into another (strong/retained) property prior to, and interrogating it after, the dismissing event.
To quote apple:
"If you want to retain a reference to the receiver’s presented view controller, get the value in the presentedViewController property before calling [ dismissViewControllerAnimated:completion:
]."