Reputation: 807
I'm using Objective-C. I want to push a new vier controller when I select a table view cell. This is my code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
detailViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"detailVC"];
//something
[self.navigationController pushViewController:vc animated:YES];
}
I have a detail view controller in my storyBoard and set its storyboard ID "deatilVC". But when I select a table view cell, the simulator freezes. Someone can help me?
Upvotes: 0
Views: 94
Reputation: 629
Take one navigation controller and make the current controller from where your didSelectRowAtIndexPath will call to it's root controller in storyboard. Check the following example.
And then drag with right click of mouse to your current controller and make it "root view controller" just like below:
Build and run your app.
Upvotes: 1