2016-06-07 24 views
0

我已经重写了下面的方法,它会在已选中的单元格上留下一点滴答声,但是,滴答声停留在那里,并且在我选择不同的行时不会被删除。取消选择行并删除Xamarin UITableView上的勾号?

public override void RowSelected(UITableView tableView, NSIndexPath indexPath) 
{ 
    SelectedRow = TableItems[indexPath.Row]; 

    var cell = tableView.CellAt(indexPath); 

    cell.Accessory = (indexPath.Row >= 0) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; 
} 

如何让这个当我选择一个不同的细胞,即选择输了球它的Tick第一个单元格,因此,只有一次一个单元有一个勾?

回答

0

编辑:我忘了有一个RowDeslected方法...

您应该能够使用RowDeselected方法来完成你想要的这里。

public override void RowDeselected(UITableView tableView, NSIndexPath indexPath){ 
    var deselectedCell = tableView.CellAt(indexPath); 
    deselectedCell.Accessory = UITableViewAccessory.None; 
} 
0

我认为你需要的财产AllowsMultipleSelection设置为false

TableView.AllowsMultipleSelection = false 
相关问题