打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
UITableView 实现Cell删除操作
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://ubluesky.com/archives/354

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
iPhone开发技巧之私有API(2)— UITableView | YIFEIYANG
UITableView侧滑删除
点击UITableView的cell展开收缩
UITableView中定义快捷键 拷贝粘贴
在tableview中添加更多的行
stupid教程
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服