I’m sure there is an easy way to do this that I am obviously missing.
I have three classes in my UINavigation Controller:
- MasterNavViewController – of type UINavigationController – owns the properties across all the subsequent view controllers.
- FirstNavViewController – of type UIViewController.
- SecondNavViewController – of type UIViewController.
For reasons of threading that I don’t want to go into here I would like to move from the FirstNavViewController to the SecondNavViewController using code. I have tried:
[self.navigationController pushViewController:SecondNavViewController animated:YES];
but I am getting an error in my code: Use of undeclared identifier ‘SecondNavViewController’ did you mean MasterNavViewController?
I’m not exactly sure how to proceed with this. I have tried importing my SecondNavViewController.h but that doesn’t seem to work either.
I’m thinking perhaps I am trying to do this the wrong way. Any pointers would be greatly appreciated! James
As Requested:
I’m not creating the SecondNavViewController explicitly in the code, I’m not sure how… but that’s where I’m going wrong most likely right?. I have created the classes & then linked them with the UIViewController that I dragged into IB. Typically I would just create a push segue between the two but in this case I do not want to do that.
SecondNavViewControlleris not equal tosecondNavViewController. Objective-C is case sensitive.So you need to SecondNavViewController instance like: