tableView删除功能小记
*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:1070
libc++abi.dylib: handler threw exception
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return [_arrKeys count];// _arrKeys中存放分组
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSString* _date = [_arrKeys objectAtIndex:section];
NSArray* _notifications = [_dictData objectForKey:_date];// _dictData存放数据
return [_notifications count];
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[self refreshData];// 刷新_arrKeys和_dictData中的数据
int newCount=0;
if (indexPath.section<[_arrKeys count]) {
NSString *_date = [_arrKeys objectAtIndex:indexPath.section];
NSArray* _notifications = [_dictData objectForKey:_date];// _dictData存放数据
newCount= [_notifications count];
}
[tableView beginUpdates];
if (newCount<=0) {
[tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section]withRowAnimation:UITableViewRowAnimationLeft];
}
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]withRowAnimation:UITableViewRowAnimationLeft];
[tableView endUpdates];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// 修改时
}
}
本文转载至 http://blog.sina.com.cn/s/blog_7b9d64af0101b6se.html
tableView删除功能小记的更多相关文章
- tableView左滑删除功能
实现三个代理方法即可 -(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtI ...
- IOS UITableView多选删除功能
UITbableView作为列表展示信息,除了展示的功能,有时还会用到删除,比如购物车.收藏列表等. 单行删除功能可以直接使用系统自带的删除功能,当横向轻扫cell时,右侧出现红色的删除按钮,点击删除 ...
- IOS UITableView删除功能
UITbableView作为列表展示信息,除了展示的功能,有时还会用到删除,比如购物车等.删除功能可以直接使用系统自带的删除功能,当横向轻扫cell时,右侧出现红色的删除按钮,点击删除当前cell. ...
- [vs2008]Visual Studio 2008 SP1添加或删除功能提示查找SQLSysClrTypes.msi文件
前言 今天接到领导布置的一个任务,是之前同事负责的项目.离职了,现在客户有些地方需要修改,由于我之前参与过,就落在我的头上了. 然后我就把代码弄了过来,打开发现其中需要用到水晶报表.(我觉得不好用,不 ...
- react.js CMS 删除功能的实现
页面效果图: 数据操作分析: 在查询表组件的 TableData.js 中操作如下内容: 给每一行绑定一个checkbox,且在点击这个 checkbox 时,触发 action 中的一个方法(fo ...
- php大力力 [042节] 今天做了一个删除功能
php大力力 [042节] 今天做了一个删除功能 if(isset($_GET['action'])){ if($_GET['action']=="del"){ $sql = &q ...
- Java递归实现操作系统文件的复制、粘贴和删除功能
通过Java IO递归实现操作系统对文件的复制.粘贴和删除功能,剪切=复制+粘贴+删除 代码示例: import java.io.BufferedInputStream; import java.io ...
- java 12-3 StringBuffer的添加和删除功能
1. StringBuffer的添加功能: public StringBuffer append(String str):可以把任意类型数据添加到字符串缓冲区里面,并返回字符串缓冲区本身 public ...
- ajax“显示弹窗详情”和“删除”功能练习
1.查看详细信息,以弹窗的形式显示,使用ajax 2.批量删除 “查询”功能可以参考前面的文章,这里只讲解ajax“显示弹窗详情”和“删除”功能 第一:在body中的代码 <title>a ...
随机推荐
- 面试-默认参数(传值)、var(传址)、out(输出)、const(常数)
相关资料:1.http://blog.csdn.net/rznice/article/details/69600112.http://www.cnblogs.com/echomyecho/archiv ...
- python基础系列教程——Python的安装与测试:python的IDE工具PyDev和pycharm,anaconda
---恢复内容开始--- python基础系列教程——Python的安装与测试:python的IDE工具PyDev和pycharm,anaconda 从头开启python的开发环境搭建.安装比较简单, ...
- 【WPF/WAF】设置快捷键(Shortcut Key)
基于WAF框架:WPF Application Framework (WAF) View层XAML中设置热键. <Window.InputBindings> <!--<KeyB ...
- 【WPF】Viewbox标签——控件大小适应父容器
需求:图片拉伸至填满Image控件. 使用标签进行嵌套. <Grid> <Viewbox> <Image Name="myImage" /> & ...
- pip国内源
pip install -i https://pypi.douban.com/simple pyqrcode
- 总结golang之map
总结golang之map 2017年04月13日 23:35:53 趁年轻造起来 阅读数:18637 标签: golangmapgo 更多 个人分类: golang 版权声明:本文为博主原创文章, ...
- B树、Trie树详解
查找(二) 散列表 散列表是普通数组概念的推广.由于对普通数组可以直接寻址,使得能在O(1)时间内访问数组中的任意位置.在散列表中,不是直接把关键字作为数组的下标,而是根据关键字计算出相应的下标. 使 ...
- 【转】【C#】ZIP、RAR 压缩与解压缩
压缩文件夹 源码如下 using System; using System.Data; using System.Configuration; using System.Web; using Syst ...
- am335x LCD背光问题
/**************************************************************** * am335x backlight problem * * 本问记 ...
- 有关JSP隐式对象,以下( )描述正确。
A.隐式对象是WEB容器加载的一组类的实例,可以直接在JSP页面使用 B.不能通过config对象获取ServletContext对象 C.response对象通过sendRedirect方法实现重定 ...