我试图使用[self tableView:self.tableView titleForHeaderInSection:section]
检索标题,但在发布此问题后很快意识到它应该从super
被调用。因此:
[super tableView:self.tableView titleForHeaderInSection:section]
。
报头可以使用定制
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSString *title = [super tableView:self.tableView titleForHeaderInSection:section];
if (title.length == 0) return nil;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 40)];
label.textColor = [UIColor whiteColor];
label.backgroundColor = [UIColor clearColor];
label.text = title;
return label;
}