ios - Check and uncheck the same UITableViewCell -


i need uncheck cell in tableview. checkbox, once pressed cell stay selected, if pressed again same cell stay unselected. possible?

all found method deselecting cells

[table deselectrowatindexpath:nsindexpath animated:yes]; 

but it's not useful

upd: don't need check many cells, need uncheck cell if tap on selected cell, , if tap on other(unselected) cell, selected should change state unselected(it's work default in cells)

where datasource load this

arrselected = [[nsmutablearray alloc] init]; (int = 0; <arrsong.count; i++) {     [arrselected addobject:[nsnumber numberwithbool:no]]; } 

in cell indexpath this

if ([[arrselected objectatindex:indexpath.row] boolvalue] == yes) {     [cell setaccessorytype:uitableviewcellaccessorycheckmark]; } else{     [cell setaccessorytype:uitableviewcellaccessorynone]; } 

to select/deselect thisin tableview:didselect

    if ([[arrselected objectatindex:indexpath.row] boolvalue] == yes) {         [arrselected replaceobjectatindex:indexpath.row withobject:[nsnumber numberwithbool:no]];     }     else{         [arrselected replaceobjectatindex:indexpath.row withobject:[nsnumber numberwithbool:yes]];     } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -