0
Ich habe einen UITableViewController und eine Liste von Kontrollkästchen in jedem Abschnitt. Was ist der richtige Weg zuWie entferne ich Häkchen von "anderen Zeilen" in einem UITableViewController
- Fetch die Zeilen für den Abschnitt
- Ändern der Checkbox des Abschnitts, so dass ich mich richtig als auch meine Unterstützung Datensicht und die UX Ansicht aktualisieren?
... in anderen Worten, ich möchte nur ein Häkchen im Abschnitt 1. Ich NSIndexPath versucht, mit, aber die Eigenschaften nur gelesen werden.
-Code
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
if (indexPath.Section ==1)
{
var thisCell = tableView.CellAt(indexPath);
if (thisCell.Accessory == UITableViewCellAccessory.None)
thisCell.Accessory = UITableViewCellAccessory.Checkmark;
else
thisCell.Accessory = UITableViewCellAccessory.None;
}
if (indexPath.Section ==2)
{
var thisCell = tableView.CellAt(indexPath);
if (thisCell.Accessory == UITableViewCellAccessory.None)
{
thisCell.Accessory = UITableViewCellAccessory.Checkmark;
// Somehow deselect all the checkboxes in the other rows
// I can't set NSIndexPath properties on a new object... so I'm stuck
}
else
{
thisCell.Accessory = UITableViewCellAccessory.None;
}
}
}