2
votes

I have 4 view controllers: VC1,VC2,VC3,VC4.

VC4 can be called from VC1,VC2,VC3, my point is how to get which one of view controller (VC1,VC2,VC3) has called VC4?

2

2 Answers

3
votes

Flohei's answer is right, but a bit long winded given there's already a method to do this in iOS. There's no real need to add another property. You can use the parentViewController property to find out which view controller is currently displaying your modal controller.

1
votes

You could add a UIViewController property to VC4 and set this one every time you create a VC4 instance to the current viewController.