Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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];
    }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
206 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...