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

时间:2016-03-03 22:57:17   收藏:0   阅读:3097

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

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!