首页 > 其他 > 详细

UItableView 编辑

时间:2015-04-04 11:49:19      阅读:173      评论:0      收藏:0      [点我收藏+]
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return @"删除";
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    debugMethod();
    NSLog(@"%ld,%ld", indexPath.section, indexPath.row);
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        //移除数据源的数据
        NSMutableArray *mutableArr = [self.goodsListArray mutableCopy];
        [mutableArr removeObjectAtIndex:indexPath.row];
        self.goodsListArray = [mutableArr copy];
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];//移除tableView中的数据
    }
}

 

UItableView 编辑

原文:http://www.cnblogs.com/apem/p/4391729.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!