分享

UITableView 实现Cell删除操作

 ccccshq 2014-02-26
1//添加以下两个接口
2- (UITableViewCellEditingStyle)tableView:(UITableView *)tv editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
3return UITableViewCellEditingStyleDelete;
4//不能是UITableViewCellEditingStyleNone
5}
6 
7//点击删除按钮后, 会触发如下事件. 在该事件中做响应动作就可以了
8- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:(NSIndexPath *)indexPath {
9      [self.myDataArr removeObjectAtIndex:indexPath.row];
10//记得在数据源中删除数据!!
11[self.myTableView deleteRowsAtIndexPaths:@[indexPath]  withRowAnimation:UITableViewRowAnimationFade];
12}

蓝天笔记:http:///archives/354

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多