我一直在尝试访问 UITableView 类中 UITableView 的一些实例方法,以按照本教程使用 NSFetchedResultsController http://www.raywenderlich.com/999/core-data-tutorial-how-to-use-nsfetchedresultscontroller
在本教程中有一段代码,您可以在其中访问 self.tableView,这是有意义的,因为您正在使用 UITableViewController。但是,我正在尝试使用 UITableView,但找不到任何使用它的示例。
查看文档,我应该有一个实例方法“beginUpdates”(reloadUpdates、insertRowsAtIndexPaths:withRowAnimation:) http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html
但是,当我尝试使用 [self beginUpdates] 访问实例方法时,我无法获取实例方法(找不到方法)。对于许多实例方法来说都是如此,但不是全部。例如,我可以访问
[self setEditing:(BOOL) animated:(BOOL)]
我对 Objective-C 相当陌生,所以我相信我正在以错误的方式访问我的 UITableView 实例,但我对该类唯一能想到的就是“self”
如何访问 UITableView 而不是 UITableViewController 中的这些方法?
最佳答案
+1 @Hollance 的评论。您可能会发现您想要自定义 View Controller 逻辑而不是子类化 UITableViewController
允许,但是 UIViewController
的子类可以更好地实现这一点由 UITableView
组成(即 tableView
销售点/酒店)。
关于ios - UITableView 使用实例方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7223641/