uitableview 左右滑动删除cell

1.自定义cell    添加  scrollview    ,scrollview上添加显示数据的控件

2.scrollview的宽度要大于tableview的宽度

 

 

-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate

{

    if (scrollView.contentOffset.x > 80) {

        scrollView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, scrollView.contentOffset.x);

              if (self.delegate && [self.delegate respondsToSelector:@selector(Protocol_historyCellDelete:)])

        {

            [self.delegate Protocol_historyCellDelete:self];

        }

    }

   

}

 

 

-(void)Protocol_historyCellDelete:(JECP_SearchHistoryTableViewCell *)cell

{

    NSIndexPath *indexPath = [tbv_list indexPathForCell:cell];

    int row = indexPath.row;

    [nma_list removeObjectAtIndex:row];

    [tbv_list deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];

       

}

 

posted on 2015-03-31 22:49  马大哈哈  阅读(257)  评论(0编辑  收藏  举报

导航