Reputation: 5546
I have a main UIViewController
which has an embedded Navigation Controller. I have 2 additional UIViewController
s that are launched from the main UIViewController
via push segues. When the user navigates from one of these two view controllers to the main UIViewController, I would like to identify from which UIViewController
the user navigated from. How can I get this information?
Upvotes: 0
Views: 51
Reputation: 5104
You can jerry rig this but the 'right' way to do this in objective-c land is to use either a delegate or NSNotificationCenter. In this particular case I think NSNotificationCenter is probably easiest... there is a great example here: Send and receive messages through NSNotificationCenter in Objective-C?
Upvotes: 0
Reputation: 1296
I can think of two ways:
1- Use delegation on the two subviewControllers
, and use the main as the delegate
handler.
2- Use viewWillDisappear
on the two subviewControllers
, and change a value on the main view controller by something like self.presentedController.yourValue
Hope this makes sense :)
Upvotes: 1