关于UITableView的一个崩溃现象分析
2015-06-03 17:16
127 查看
*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:1582
出现这个奔溃的现象原因在下面这行代码中
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
至于解决办法,参考Stack Overflow的一个回复
To fix it,
tableView:commitEditingStyle:forRowAtIndexPath:needs
to check for the "The user deleted the last row" case and handle it differently. When you're at the last row, you have two options:
Refresh your existing index path (it should transform into the placeholder cell):
[self.tableView beginUpdates]; [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft]; [self.tableView endUpdates];
Delete the user's cell and insert the placeholder cell:
[self.tableView beginUpdates]; [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft]; [self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationLeft]; [self.tableView endUpdates];
但是自己的还是未解决,因为自己做的是移动cell,有待研究好的方法。如果有知道的大神,求告知。
相关文章推荐
- Visual Studio 2013 无法使用:在文件中查找(Ctrl+Shift+F)
- Android 安装apk过程中奔溃
- libcurl的curl_easy_perform奔溃问题
- 解决cocos2d-js集成到ios原生应用中退出游戏,再加载游戏时会奔溃的问题
- perl中创建多进程
- 关于Mac Sierra 10.12 搜狗输入法奔溃
- iOS 真机、模拟器调试 CrashMonkey4IOS
- ios10.0相册拍照闪退原因
- 华为手机碰到的问题记录-NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID
- mac上使用cocos studio 经常随意奔溃问题解决方法
- linux系统奔溃后的紧急救援模式
- iOS:Xcode Build Settings(二)--一些设置(值)
- 国内UED大全
- 501 Critical Reading Questions
- UIColor, UIFont, UIImage
- UITableView默认选中第一个cell
- UIPageViewController-浅析
- YOUTH--- Samuel Ullman
- 更改Map过程中用于区分不同key/value对的分隔符
- UIButton使用汇总