我有其中包含多个部分的表格视图。 我想选择的只有一排...我的tableview的选择属性被设置为允许:SingleSelectioin在tableview中取消选择先前选择的单元格
现在我这样做是为了设置复选标记选定行
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)
坏接入请帮助我这个
任何新建议也欢迎
您是否在使用ARC?如果不尝试:[lastIndexpath release]; lastIndexpath = [indexPath retain]; – iTukker
是的现在它不是给我BAD_ACCESS,但我想要的是,一次只应选择一行 – Anand
你能检查以下吗? lastIndexpath = indexPath.row; –