How to enable reordering of a UITableViewCell without deleting a control using the setEditing method?

When I use [tableview setEditing:YES animated:YES]; To enable reordering of a UITableViewCell, a delete element also appears. How can I prevent this?

+4
source share
2 answers

Add -tableView:editingStyleForRowAtIndexPath: to the table view delegate and return UITableViewCellEditingStyleNone .

+15
source

Add this method to youc code:

 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return NO; } 
0
source

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


All Articles