Reputation: 5754
I am setting a UITableView
with sections. The numberOfSectionsInTableView:
method is being called properly and is returning the right result (in my case 3) but the titleForHeaderInSection
is not being called at all, and the resulting tableview contains the rows but no sections.
Is there a way to make sure this method gets called by the tableview?
Here is the implementation:
- (NSString *) titleForHeaderInSection:(NSInteger)section
{
NSString *sectionHeader = nil;
if (section == 0)
{
sectionHeader = @"Alpha";
}
if (section == 1)
{
sectionHeader = @"Beta";
}
if (section == 2)
{
sectionHeader = @"Gamma";
}
NSLog(@"%@", sectionHeader);
return sectionHeader;
}
Upvotes: 0
Views: 1599
Reputation: 12460
The method signature is - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
your method is is missing the first parameter tableView
and will not get called.
Upvotes: 2