2011-07-22 23 views
1

如何在tableView中取消先前選擇的行?我無法找到解決方案,以獲得oldIndexPathdidSelectRowAtIndexPath:如何獲取舊的indexPath以取消勾選複選標記?

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath]; 
    if (newCell.accessoryType == UITableViewCellAccessoryNone) { 
     newCell.accessoryType = UITableViewCellAccessoryCheckmark; 
    } 
} 

回答

2

除非你保存以前的索引路徑,你將無法取回。
只需將它存儲在ivar中,當您檢測到一行被選中時,下次您將能夠刪除前一個單元格上的複選標記。

+0

謝謝,我已經找到了這個解決方案 – LIAL

相關問題