UITableViewRowAction按钮在单列中显示

时间:2015-05-06 17:36:52

标签: objective-c uitableview uitableviewrowaction

您好我正在使用具有更大行高的表格视图,我需要在滑动单元格时使用两个按钮编辑和删除。我使用以下代码获得了这两个按钮: -

  -(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewRowAction *button = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath)
                                    {
                                       // Logic
                                    }];
    button.backgroundColor = [UIColor redColor]; //arbitrary color
    UITableViewRowAction *button2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@" Edit " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath)
                                     {
                    // Logic
                                     }];
    button2.backgroundColor = [UIColor lightGrayColor];
    return @[button, button2];
}

这两个按钮出现在两列中,我需要它们在一列中两行。我已经看到几乎所有的表格单元都有这种结构(多列)。请帮帮我

1 个答案:

答案 0 :(得分:0)

GitHub上有一个名为https://github.com/srikanth-vm/GSSwipeableCell的开源项目,它实现了该功能。