像这样的功能:
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
NSLog(@"called")
return 1;
}
没有被调用,因为日志没有出现在控制台上。我尝试使用
[table realoadData]
但它仍然不起作用
像这样的功能:
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
NSLog(@"called")
return 1;
}
没有被调用,因为日志没有出现在控制台上。我尝试使用
[table realoadData]
但它仍然不起作用
确保将 UITableViewDataSource 和 UITableViewDelegate 设置为该方法所在的类
.h
@interface class_name : UIViewController <UITableViewDelegate, UITableViewDataSource>
{ UITableView *tableView; }
.m
in the viewDidLoad (or any other loading method)
tableView.delegate = self;
tableView.dataSource = self;
如果你是 UITableViewController 的子类,它应该已经可以工作了
希望有帮助!