iOS UITableView删除组中唯一行,即[UITableView _endCellAnimationsWithContext:] warning

在iOS项目中要删除某一行,此行是此组中最后一行,在使用 UITableView 的方法: 

self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .None)

但未能成功,Warning:Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:1070

后查找Baidu发现一篇博客:http://blog.sina.com.cn/s/blog_7b9d64af0101b6se.html 

修改代码:

self.tableView.beginUpdates()
self.tableView.deleteSections(NSIndexSet(index: indexPath.section), withRowAnimation: .None)
self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .None)
self.tableView.endUpdates()

 

posted @ 2016-03-03 21:29  chrisbin  阅读(692)  评论(0编辑  收藏  举报