UITableViewCell edit style for specific rows

I am trying to delete specific rows in a UITableView using the delegate method below

 tableView commitEditingStyle:editingStyle forRowAtIndexPath: 

My intention is to not show the "Delete" button only for certain cells. please anyone can help me how to solve this problem.

+4
source share
1 answer

Use the following Datasource method for a UITableView

 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the apply specified item to be editable. if("Your Condition") // such like indexPath.row == 1,... or whatever. return YES; else return NO; } 

In short, return YES for the specific row / cell you want to change otherwise return NO;

+5
source

Source: https://habr.com/ru/post/1500134/


All Articles