-1

I have lots of rows in the Master, the first time I click a row, the content is displayed in Details. I go back, choose a new row, or the same row, it displays "Detail view content goes here" in Details. I've traced like crazy, used NSLog just in case it's some kind of event reordering, used setNeedsDisplay in the view and in the UIControl instance. Everything is tracking out okay in the right order, but nothing is displaying the new content. NSLog shows the new content is in the control, just not being displayed. Any assistance would be welcome, this is driving me crazy.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"showDetail"]) {
        NSIndexPath *indexPath = [[self tableView] indexPathForSelectedRow];
        NSObject *object = [[[self objects] objectAtIndex:[indexPath section]] objectAtIndex:[indexPath row]];
        [[segue destinationViewController] setDetailItem:object];
    }
}
Brian
  • 11,132
  • 7
  • 32
  • 43
Yimin Rong
  • 1,413
  • 3
  • 23
  • 44
  • It seems like there's something wrong with you code in the `didSelectRowAtIndexPath:` method. The "Detail view content goes here" comes from the DetailViewController in the XCode template. In general and especially in this case, you should provide your code. At least form the method mentioned above. – Tobi Oct 26 '12 at 09:58
  • 1
    Add the code for `didSelectRowAtIndexPath:` to your question - otherwise this is pure guess-work. – Till Oct 26 '12 at 11:01
  • The equivalent if you're using storyboards would be the prepareForSegue method. – Steven Fisher Oct 27 '12 at 01:37
  • Found out the problem. I am updating by sending a message to the receiver. I had included code to set the receiver but assumed it wouldn't be changed after it was set. It turns out detail views are created new each time so the previous link would be invalid. – Yimin Rong Nov 08 '12 at 21:50

1 Answers1

0

I am updating by sending a message to the sender. I had included code to set the sender, e.g. the detail view, but assumed it wouldn't be changed after it was set. It turns out detail views are created new each time so the previous link would be invalid. Fixed it by simply resaving the sender every time the view is constructed.

Yimin Rong
  • 1,413
  • 3
  • 23
  • 44