首先设置 tableView 可编辑 

self.tableView.editing = YES;

设置 tableView 的编辑样式:

return UITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert;

这样子就多选啦 

接下来单选只需要在

– (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath加一个判断

if (tableView.indexPathsForSelectedRows.count > 1) {

       [tableView deselectRowAtIndexPath:tableView.indexPathsForSelectedRows[0] animated:NO];

    }

ok 啦附上截图

版权声明:本文为ios-dyc1998原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/ios-dyc1998/p/8303607.html