색상과 글꼴을 이름 변경 등 4 개의 섹션으로 나눈 TableView에서 변경하는 데 문제가 있습니다. 작동하지 않는 것 같습니다. 내가 잘못하고있는 것이 확실하지 않습니다.sectionName TableView - 내가 뭘 잘못하고 있니?
- (NSString *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionName = nil;
switch(section)
{
case 0:
sectionName = [NSString stringWithString:@"Date"];
break;
case 1:
sectionName = [NSString stringWithString:@"Gig"];
break;
case 2:
sectionName = [NSString stringWithString:@"City"];
break;
case 3:
sectionName = [NSString stringWithString:@"Country"];
break;
}
UILabel *sectionHeader = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 40)] autorelease];
sectionHeader.backgroundColor = [UIColor clearColor];
sectionHeader.font = [UIFont boldSystemFontOfSize:18];
sectionHeader.textColor = [UIColor whiteColor];
sectionHeader.text = sectionName;
return sectionName;
}
이 코드가 질문의 코드와 다른 점/이유를 설명해주십시오. 코드만으로 구성된 대답은 일반적으로 좋은 대답이 아닙니다. – jrturton
예, 코드를 설명해 주시겠습니까? 시도해 보았습니다. 이제 섹션 이름이 뷰에서 사라졌습니다! 감사합니다 –
@ NathanCleary 메서드에서 높이를 설정하십시오 - (CGFloat) tableView : (UITableView *) tableView heightForHeaderInSection : (NSInteger) 섹션 – Neo