Lord Zsolt
Lord Zsolt

Reputation: 6557

iOS - navigation controller from storyboard

I have embedded my view controller in a navigation controller on my storyboard, then added a table view which I configured from code. I'm trying to make it, when I click a row in the table, it should change the view and putting the subview into the stack, however I can't access the navigation controller.

[self.navigationController pushViewController:disclosureView animated:YES];

When this code launches, it gives the error: " NavController[990:c07] Application tried to push a nil view controller on target . "

Upvotes: 0

Views: 234

Answers (1)

Kumar KL
Kumar KL

Reputation: 15335

I hope that you didn't get call the ViewController properly :

if(indexPath.row == 0)

   UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
        UIViewController *disclosureView = [storyboard instantiateViewControllerWithIdentifier:@"disclosureView" ];

        [self.navigationController pushViewController:disclosureView animated:YES];

Here is the screenShot for getting the UIViewController identifier: enter image description here

Upvotes: 1

Related Questions