UIDetailViewController doesn't show with Storyboard

When I coding with Storyboard, I’m not sure UIDetailViewController be pushed in navigationControllers or not. there is a view showed with black color background when I touch tableviewcell.


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    SOCDetailViewController *detailViewController = [[SOCDetailViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:YES];

code nothing else more just like book writes

Who can help me T^T please

You need pass the selectedItem to the detailviewcontroller

Can anyone else elaborate on this? I’m also trying to do this on Storyboard but I get the same error. Not too sure what @lookingfor means, I might have to get back home to check the code to understand it a bit better.

Figured it out after a bit of research, in case anyone is interested

[code]-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
BNRDetailViewController *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@“BNRDetailView”];

//Put it onto the top of the navigation controllers stack
[self.navigationController pushViewController:detailViewController animated:YES];


This will create a new BNRDetailViewController from the storyboard BUT you must set the identifier to same name as you pass in. In my case I named that storyboard view “BNRDetailView”. You can set any identifier you want by going to your storyboard, clicking on the BNRDetailViewController in the storyboard and in the identity inspector theres a field called “Storyboard ID” which is what you’re passing in the “instantiateViewControllerWithIdentifier:” call. So just make sure whatever you type in there you insert in your code.