【问题标题】:how to create a delete button when user swipe a cell in table view [duplicate]当用户在表格视图中滑动单元格时如何创建删除按钮[重复]
【发布时间】:2011-11-11 21:26:26
【问题描述】:

可能重复:
UITableViewCell show delete button on swipe
iPhone Dev: Swipe a UITableCell

当用户在表格视图中滑动单元格时,我想创建删除按钮。如果用户滑动单元格表格进入编辑模式并允许他们删除滑动单元格。

【问题讨论】:

    标签: iphone objective-c


    【解决方案1】:
     - (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
     {
        if(editingStyle == UITableViewCellEditingStyleDelete)
            {
                        yourTableView.editing = YES;
                        // your code for deletion here
            }
    
    
     }
    

    【讨论】:

      【解决方案2】:

      你可以参考this

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-10-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-12-27
        • 1970-01-01
        相关资源
        最近更新 更多