PopViewControllerAnimated does not update iPhone SDK information

When I try to call the view controller, it does not update the information for the previous view. Example. I have a cell that displays the text in a shortcut in View1. When you click on a cell, it goes into View2 (for example). When I select an option in View2, popViewControllerAnimated is used to return to View1, however I want the label to now update with a new option in View1.

My dilemma is that when I pop View2, the shortcut in View1 is not updated. Any ideas? I tried to add [view1 reloadData]; before watching the views, but no luck.

//VIEW1 the cell that displays the label.
    ringLabel = [[UILabel alloc] initWithFrame: CGRectMake(25, 12.7f, 250, 20)];
    ringLabel.adjustsFontSizeToFitWidth = YES;
    ringLabel.textColor = [UIColor blackColor];
    ringLabel.font = [UIFont systemFontOfSize:17.0];
    ringLabel.backgroundColor = [UIColor clearColor];
    ringLabel.textAlignment = UITextAlignmentLeft;
    ringLabel.tag = 0;
    ringLabel.text = [plistDict objectForKey:@"MYOPTION"];
    [ringLabel setEnabled:YES];
    [cell addSubview: ringLabel];
    [ringLabel release];


//VIEW2 when cell clicked 
    CustomProfileViewController *cpvc = [CustomProfileViewController alloc];
    cpvc.ringtone = [ringList objectAtIndex:indexPath.row];
    [cpvc.tblCustomTable reloadData];
    [self.navigationController popViewControllerAnimated:YES];
+3
source share
3 answers

-viewWillAppear: . (, super).

:

- (void)viewWillAppear:(BOOL)animated {
    // This method is called whenever the view is going to appear onscreen.
    // (this includes the first time it appears.)
    ringLabel.text = [plistDict objectForKey:@"MYOPTION"];
    [super viewWillAppear:animated];
}
+6

plistDict? ? , @MYOPTION , ? , plistDict - viewController. 4 . , .

0

, dealloc. . , , .

0
source

Source: https://habr.com/ru/post/1725465/


All Articles