ios - Tableview, selected cells, not accepting user clicks -


i have uitableview preferences page. save user selections using nsdefaults, , on load reload defaults , setup tableview cells appear selected.

i in method

   - (uitableviewcell *)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath { //if cell should if selected preference {     uiview *selectioncolor = [[uiview alloc] init];     selectioncolor.backgroundcolor = [uicolor colorwithred:(200/255.0) green:(200/255.0) blue:(200/255.0) alpha:0.6];     cell.selectedbackgroundview = selectioncolor;     cell.selected = true; } else{     cell.selected = false; } return cell; } 

now if user unselects cell handle here

  - (void)tableview:(uitableview *)tableview diddeselectrowatindexpath:(nsindexpath *)indexpath 

the problem have if load app, , set cells selected, never accept click event on them!! user can never unselect them.

it may helpful .

try method

 - (uitableviewcell *)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath { if (indexpath.row == selectedrow) {     uiview *selectioncolor = [[uiview alloc] init];     selectioncolor.backgroundcolor = [uicolor colorwithred:(200/255.0) green:(200/255.0) blue:(200/255.0) alpha:0.6];     cell.selectedbackgroundview = selectioncolor;     cell.selected = true; } else{     cell.selected = false;cell.selectedbackgroundview = nil; } return cell; } 

please let me know if need details .


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -