*** 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