我有一个 UITableViewController 类。我正在使用 NSMutableArray 来填充表格单元格。我正在从数据库获取数据并将其添加到数组中。但细胞显示的是旧结果。如何使用 reladData 方法以及我应该在 UITableViewController 中的何处调用此方法?
最佳答案
我引用苹果的文档何时不使用它:
The table view's delegate or data source calls this method when it wants the table view to completely reload its data. It should not be called in the methods that insert or delete rows, especially within an animation block implemented with calls to beginUpdates and endUpdates.
因此,当您更改模型但不使用 tableview 方法来更改表时调用它,例如:
deleteRowsAtIndexPaths:withRowAnimation:
deleteSections:withRowAnimation:
insertRowsAtIndexPaths:withRowAnimation:
insertSections:withRowAnimation:
关于iphone - 如何使用iphone tableView的reloadData方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5598893/