美文网首页
iOS 8以后滑动cell删除等菜单

iOS 8以后滑动cell删除等菜单

作者: CCSHCoder | 来源:发表于2016-08-22 15:48 被阅读54次
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewRowAction *row1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"编辑", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"%ld的编辑",(long)indexPath.row);
    }];
    row1.backgroundColor = [UIColor orangeColor];
    
    UITableViewRowAction *row2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"删除了", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"%ld的删除",(long)indexPath.row);
    }];
    row2.backgroundColor = [UIColor blueColor];
    
    return @[row1,row2];
}

相关文章

网友评论

      本文标题:iOS 8以后滑动cell删除等菜单

      本文链接:https://www.haomeiwen.com/subject/ixhgsttx.html