ios - Reload UIViewController in "viewDidLoad" -
i change value of 2 uilabels in "viewdidload" method, need view refresh after in order display values. stands, uilabels display value of selected cell. need refresh right after change labels' values. "setneedsdisplay" method not doing job.
- (void)viewdidload { [super viewdidload]; // additional setup after loading view. _namelabel.text = _selectedlocation.name; _addresslabel.text = _selectedlocation.address; [self.view setneedsdisplay]; }
based on comments, think trying like:
- (void)updatelabeltexts { _namelabel.text = _selectedlocation.name; _addresslabel.text = _selectedlocation.address; }
and wherever changing _selectedlocation
values:
//just example -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; _selectedlocation = _yourlocationsarray[indexpath.row]; //now call update method [self updatelabeltexts]; }
the point have call [self updatelabeltexts];
after update values.
Comments
Post a Comment