iOS开发--UITableViewCell侧滑多个按钮(系统仅支持iOS8以上)

来源:互联网 发布:哪里有淘宝教学视频 编辑:程序博客网 时间:2024/06/06 17:32
/** *  block里面是点击方法 , 这个委托是ios8之后的才有,如果项目只适配ios8以上就可以不用自己写按钮了。返回值是 UITableViewRowAction 的数组 */-(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{    UITableViewRowAction *rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault                                                                         title:@"删除"                                                                       handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {                                                                           NSLog(@"删除");                                                                       }];    UITableViewRowAction *rowActionSec = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault                                                                            title:@"更多"                                                                          handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {                                                                              NSLog(@"更多");                                                                          }];    rowActionSec.backgroundColor = [UIColor greenColor];    NSArray *arr = @[rowAction,rowActionSec];    return arr;}
0 0
原创粉丝点击