1

I have 3 view controller. my firstview controller i mean root view controller is normal view controller that not a navigationcontoller. i want my 2nd view controller as a navigationcontoller to push 3rd and 4th viewcontrollers. below image its showing exact my storybord but when i navigate its not working kindly guide me where i'm doing wrong.

this is the code i'm using for navigate to another view controller

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ViewController2 *yourViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController2"];
    [self.navigationController pushViewController:yourViewController animated:YES];

}

enter image description here

2
  • You must connect the NavigationController to your RootViewController... Commented Feb 28, 2013 at 6:41
  • @SaravanaVijay i don't want my RootViewController as a NavigationController. i want my second view controller as NavigationController. Commented Feb 28, 2013 at 6:44

1 Answer 1

2

Connect first view controller to navigation controller and present modally. Then connect navigation controller to table view controller. Connect the tableViewCell to the detail view and push it

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Why you want to push programmatically? You need to pass any thing to view controller2 ??
You can pass the data in prepareForSegue: :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.