DevC
DevC

Reputation: 7022

Detect which controller has been popped in root view

Is it possible to detect which 'UIViewController' has been popped in the root view controller? I have 3 view controllers, A->B->C. Both B and C have popping actions. Is it possible to detect whether it was B or C was popped in A?

Upvotes: 0

Views: 60

Answers (1)

Lord Zsolt
Lord Zsolt

Reputation: 6557

I much rather prefer using delegate for this over something likfe NSNotificationCenter or NSUserDefaults.

You define a protocol, which has a method like this:

- (void)willPopToRootFromViewController(UIViewController *)fromViewController;

You implement this method in A, and the other view controllers call this method before popping.

You can find a complete example on how to implement a delegate here.

Upvotes: 1

Related Questions