tableView左滑是开发中常见的操作方式,之前一直用 MGSwipeTableCell
如果您有以下问题:
- iOS11下自定义按钮图片不显示
- iOS12下图片为白色,改不了颜色
- 想用系统原生的方案解决问题
那您就继续往下看
iOS 11 新增了两个方法,个人觉得比原先的方法好用多了,不用手动控制 tableView 的 edit,当滑动时会自动开启
// Swipe actions
// These methods supersede -editActionsForRowAtIndexPath: if implemented
// return nil to get the default swipe actions
- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView leadingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos);
- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(