If I return false in canEditRowAtIndexPath
because I want to forbid delete row when swiping to left, but meantime I want to let user to change order of rows. It seems not possible. canMoveRowAtIndexPath
will not get called.
Any idea how to make rows moveable but not editable?
You can do something like this:
For cell to be movable:
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
For cell to be Non Deletable:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleNone;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.