ios - Setting Accessory on cell in viewDidLoad -


i have 2 table view controllers, "root" , "detail". in root view have cell says "status". need able change that. when click seguewayd detailed view shows statuses can pick (static cells). when click on status, checkmark displayed. checkmark needs displayed when status chosen. checkmark should visible seguawayd in root view.

i able display checkmark next status click cell. when want checkmark displayed when i'm seguawayd, doesn't show. code im using

- (void) setcheckmarkonindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [self.tableview cellforrowatindexpath:indexpath];      cell.accessorytype = uitableviewcellaccessorycheckmark; }  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     [self setcheckmarkonindexpath:indexpath]; }  - (void)viewdidload  {     [super viewdidload];      // indexpathforrow set third cell demo     [self setcheckmarkonindexpath:[nsindexpath indexpathforrow:2 insection:0]]; } 

enter image description here static cells statuses

you need store user selection somewhere, , pass controller (or access in controller depending on it's saved , object owns information).

currently, don't save user selection can't update cell. note should updating selected cell in viewdidappear:, not viewdidload, , should @ using tableview:willdisplaycell:forrowatindexpath: deal table view being scrolled (and cells being replaced / reused).


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -