0

functions like this one:

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    NSLog(@"called")
    return 1;
}

aren't being called, because the log doesn't appear at the console. I tried using

[table realoadData]

but it still doesn't work

TylerH
  • 20,799
  • 66
  • 75
  • 101
raej99
  • 85
  • 5

2 Answers2

3

Make sure that you have both the UITableViewDataSource and UITableViewDelegate set to the class that this method is located in

.h 
@interface class_name : UIViewController <UITableViewDelegate, UITableViewDataSource>
{ UITableView *tableView; }

.m
in the viewDidLoad (or any other loading method)

tableView.delegate = self;
tableView.dataSource = self;

If you are subclassing UITableViewController, it should be working already

hope that helps!

user2277872
  • 2,963
  • 1
  • 21
  • 22
2
  1. In Nib file, you need to outlet tableview.
  2. Your subclass must have UITableViewDataSource and UITableViewDelegate.
  3. Assign tableview.delegate = self and tableView.dataSource = self;
Tan Vu
  • 728
  • 8
  • 15