I have 3 vcs (say VC_A, VC_B, VC_C, all embedded in a navigation controller which has a subclassed uinavigationcontroller class (say MyNavClass). In MyNavClass I have overridden supportedInterfaceOrientations().
In this method I have a statement like this:
NSLog(self.topViewController.restorationIdentifier!)
For whatever reason, when I navigate through the view chain, only VC_A is logged to console, but not VC_B and VC_C. Any ideas why?
VC_A has a navigation bar item that leads to VC_B. VC_B has a collection view, and on selecting an item in this collection view, VC_C is shown. And you can navigate all the way back to VC_A using the nav bar back button.
I also tried various combinations as follows but none works:
NSLog(self.visibleViewController!.restorationIdentifier!)
NSLog(self.navigationController?.viewControllers.last.name)
EDIT: I just realized the supportedInterfaceOrientations is not getting called at all when VC_B and VC_C are pushed onto the navigation controller! Why is this happening. How to solve this?