*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:1070html
libc++abi.dylib: handler threw exceptionc++
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{url
return [_arrKeys count];// _arrKeys中存放分組spa
}代理
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{調試
NSString* _date = [_arrKeys objectAtIndex:section];htm
NSArray* _notifications = [_dictData objectForKey:_date];// _dictData存放數據blog
return [_notifications count];get
}it
- (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