iphone - cellForRowAtIndexPath and Cell Configuration -


okay, consumate standard template code uitableviewcontroller, i've been using cellforrowatindexpath: set uitableviewcells based on data source.

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { //cell setup cell.textlabel.text = @"initial data!"; return cell; } 

however, striking me problematic practice. instance, lets want this

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {   //some processing or data update done here   //now want update cell   uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];   cell.textlabel.text = @"new data"; } 

it seems wasteful code, because retrieving cell update it, causing updated second time code in cellforrowatindexpath.

so should putting configuration cell somewhere else , calling other way, or should writing configuration in cellforrowatindexpath in more clever way simple call update ui withou

maybe altering data better idea.

i'm assuming data array? alter data in didselectrowatindexpath method , reload selected cell.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -