Search code examples
iosuinavigationcontrollerif-statement

How to know which viewController is on navigation controller?


I'm following a tutorial for Facebook connect, all is fine. The problem is that I'm doing it programatically, and in one part according to the view controller from a nib, something happens.

if ((self = [super initWithNibName:@"FBFunLoginDialog" bundle:[NSBundle mainBundle]])) {

So how can I do the same but with my navigationController?

How can I know if the navigation controller is in the MainViewController?


Solution

  • if (self.navigationController) {
        // your view controller is inside a navigation controller
    }