0
viewForHeaderInSection의 textLabel의 textColor는 항상 회색입니다. BackgroundColor가 예상대로 변경됩니다. 다음은 headerview를 만드는 코드입니다. "! headerView"조건으로 들어갑니다. ios sdk 사용하기iOS 7 - viewForHeaderInSection textlabel은 항상 회색입니다.
- (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;
}
당신은 어딘가에'UILabel'의 기본 모양 색상을 설정하는, 또는 당신은 당신의 컨트롤러 어디에서나 헤더의 텍스트의 색상을 변경? 귀하의 코드가 잘 작동하기 때문에 (머리말의 텍스트 만 바 꾸었습니다) – Stonz2
[이 페이지] (http://codehappily.wordpress.com/2013/10/07/ios-how-to-customize-table- view-header-and-footer-colors /) tableView에서 색상이 변경되었습니다. willDisplayHeaderView : forSection : –
아 그룹 스타일 테이블보기를 사용해야합니다. – Stonz2