재정의있는 tableView : viewForHeaderInSection : 당신의있는 UITableViewController에 :
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIFont *font = [UIFont fontWithName:@"Helvetica Neue UltraLight" size:24];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 3, tableView.bounds.size.width - 10, 33)];
label.font = font;
label.textColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.75];
label.backgroundColor = [UIColor clearColor];
label.text = @"A";
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, TableView.bounds.size.width, 44)];
[headerView addSubview:label];
[headerView setBackgroundColor:[UIColor clearColor]];
return headerView;
}
당신은 적절 섹션 헤더에서 원하는 텍스트를 기반으로 프레임 높이를 조정해야합니다. 올바른 높이 값을 계산하려면 NSString sizeWithFont : constrainedToSize : lineBreakMode :를 사용하십시오.
출처
2013-06-19 20:47:10
mjk
죄송합니다. 가혹한 것처럼 보일지 모르지만 ** 그 **를 모르는 경우 Objective-C와 'Foundation Framework'(및 기타)를 배우면서 맨 처음부터 시작하는 것이 좋습니다. 아이폰 개발로 뛰어 들기보다 ... – HAS