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()

 

文章来自:http://www.cnblogs.com/chrisbin/p/5240155.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3