ios UITableView editing 编辑状态

https://www.jianshu.com/p/f65ca53fc9ba

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

该方法支持tableview cell侧滑删除或者增加,只支持单个操作,在ios3.0之后支持该方法

- (nullable NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;

该方法支持tableview cell的侧滑,支持多个侧滑按钮,在ios 8.0之后支持该方法

在此说明

allowsMultipleSelectionDuringEditing

在iOS5.0中UITableView增加了allowsMultipleSelectionDuringEditing属性和indexPathsForSelectedRows方法,allowsMultipleSelectionDuringEditing属性默认为NO,当此值为YES时,UITableView进入编辑模式不会向dataSource查询editStyle,而会直接每个Cell的左边显示圆形选择框,点击选择该行后圆形框里面为对勾。可使用indexPathsForSelectedRows方法获取到所有选择行的indexPath。
 苹果公司提供了使用此种方式的实例代码:TableMultiSelect 注:当allowsMultipleSelectionDuringEditing属性为YES时,不管当前在不在编辑模式内,swipe to delete都不起作用,若要同时使用swipe to delete,需在完成选择任务后,将tableView的allowsMultipleSelectionDuringEditing恢复为NO。另外,多选”控件可与”重排序”控件同时出现。

猜你喜欢

转载自blog.csdn.net/georgehenrywilliam/article/details/86374280