PrepareForSegue Tableview issue

I have a segue :

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"showDetail"]) {
        NSIndexPath *indexPath = [self.myTableView indexPathForSelectedRow];
        LyricViewController *destViewController = segue.destinationViewController;
        NSString *name = [songTitles objectAtIndex:indexPath.row];
        destViewController.lyric = [lyricDic objectForKey:name];
    }
}

When i click and go to the detail view, it always display the first element in the array/dic.

The problem is i forgot to connect the IBOutlet to the tableview.

The same as this POST.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s