我在iOS表格行中實現了行顏色更改邏輯,我通過將標題更改爲「更改顏色」來使用刪除按鈕,並且點擊那個按鈕,我想改變那個按鈕被點擊的特定行的顏色。如何在點擊刪除按鈕上更改表格行顏色,而不是刪除iOS中的一行
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete)
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.contentView.backgroundColor = [UIColor redColor];
}
}
我試圖執行顏色變化邏輯內部上面的方法,但它不是反射,並且只有數據重裝後反射,但仍索引改變-2行。
如何更改點擊「更改顏色(刪除)」按鈕並隱藏按鈕(即取消編輯)的行的表顏色?
謝謝你的工作完美 – Kiran