viewForHeaderInSection の textLabel の textColor は常に灰色です。BackgroundColor は期待どおりに変更されます。以下は、headerview を作成するコードです。「!headerView」状態になります。iOS SDK 7.1 の使用
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
static NSString *headerIdentifier = @"InspectionQuestionHeader";
UITableViewHeaderFooterView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerIdentifier];
if (!headerView) {
headerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:headerIdentifier];
headerView.contentView.backgroundColor = [UIColor grayColor];
// Why doesn't this work?
headerView.textLabel.textColor = [UIColor whiteColor];
}
InspectionQuestionSection *questionSection = _questionSections[section];
NSString *title = [NSString stringWithFormat:@"%@. %@", questionSection.sectionNumber, questionSection.sectionDescription];
headerView.textLabel.text = title;
return headerView;
}