IOS uitableviewcell 向左滑动删除编辑等

主要实现这个方法就好了

-(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{

    return @[

             [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:NSLocalizedString(@"编辑", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {

                   //点击编辑的具体超作

             }],

             [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"删除", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {

                   //点击删除的具体超作

             }]

             ];

}

在返回的数组当中还可以添加更多的按钮   不建议写太多3个上限

 

posted on 2016-08-23 12:12  小小鸟的梦想  阅读(365)  评论(0编辑  收藏  举报