I have a plist (array of dictionaries) which populates a table view and works properly. I use Xcode 4 with storyboards.

Now I've created a detail view from a regular UIViewController and of course I want the selected name to be displayed in the nameLabel in the detail view. But I can't make the right connection. This is my code so far:

Or, if you are generating it programmatically, you must first set nameLabel or it will be nil. @synthesize doesn't set the variable, it simply generates getters and setters so that you can set it from outside.

EDIT: If you are using Storyboards, it appears that you have to do the following.

Storyboards are all about relationships. Inside the story board editor, you add buttons and tell them which view controller they connect to. The same idea applies to TableView Cells. You can add a prototype table view cell (and customize it) and assign a relationship to it. The relationship you will want to give it is your detail view.

1.) Subclass UITableViewCell and give it a property that is the dictionary that you are trying to send to the detail view

2.) When creating cells (cellForRowAtIndexPath:) you will need to make sure to dequeue your custom cell and assign your dictionary to the property that you gave it.

3.) Make sure that your detail view has the identifier: DetailView

4.) Inside the table view controller, add the following code:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"DetailView"])
{
//This works because by the time prepareForSeque: is called, the navigationController has loaded the new view
((DetailView *)[[self.navigationController viewControllers] objectAtIndex:0]).dataProperty=((MyCustomTableViewCell *)sender).dataProperty;
}
}