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;
}
The method signature is
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)sectionyour method is is missing the first parametertableViewand will not get called.