複数のセクションを含むテーブル ビューがあります。1行だけ選択できるようにしたい...私のテーブルビューの選択プロパティは次のように設定されています:SingleSelectioin
今、選択した行にチェックマークを設定するためにこれを行っています
if([tableView cellForRowAtIndexPath:indexPath].accessoryType == UITableViewCellAccessoryCheckmark)
{
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
}
else
{
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
}
今私が欲しいのは、他のセルを選択すると、以前に選択したセルを選択解除に戻す必要があるということです。
私はこれで試しました
lastIndexpath=indexPath;
その後
[tableView deselectRowAtIndexPath:lastIndexpath animated:YES];
しかし、それは私にlasIndexPathへの悪いアクセスを与えます
EXC_BAD_ACCESS (code=1,address= 0xfe000008)
親切にこれを手伝ってください
新しい提案も歓迎します