The multi-choice procedure is as follows:
-(void) TableView: (UITableView *) Tableviewdidselectrowatindexpath: (Nsindexpath *) Indexpath
{
[Tableviewdeselectrowatindexpath:indexpath Animated:yes];
Custom *cell= (custom*) [TableView Cellforrowatindexpath:indexpath];
Nsuintegerrow = [Indexpath row];
Nsmutabledictionary *dic = [Contacts Objectatindex:row];
if ([[dicobjectforkey:@ "Checked"] isequaltostring:@ "NO"]) {
[DiC setobject:@ "YES" forkey:@ "checked"];
[Cell Setchecked:yes];
}else{
[DiC setobject:@ "NO" forkey:@ "checked"];
[Cell Setchecked:no];
}
}
In the cell class, add the bool attribute checked and set method setchecked ...
The full selection procedure is as follows:
Nsarray *anarrayofindexpath = [Nsarray arraywitharray:[contactlistindexpathsforvisiblerows]];
for (int i =0; i < [contacts count]; i++) {
Nsindexpath *indexpath= [Anarrayofindexpath objectatindex:i];
Custom *cell = (custom*) [Contactlistcellforrowatindexpath:indexpath];
Nsuinteger row = [Indexpath row];
Nsmutabledictionary *dic = [Contacts Objectatindex:row];
if ([[[[(uibutton*) sender Titlelabel] text] isequaltostring:@ "Select All"]) {
[DiC setobject:@ "YES" forkey:@ "checked"];
[Cell Setchecked:yes];
}else {
[DiC setobject:@ "NO" forkey:@ "checked"];
[Cell Setchecked:no];
}
}
All-in-UITableView and multi-select features of iOS crazy detailed