iOS7 및 iOS6에서 실행해야하는 앱을 만들고 있습니다. iOS6 버전의 경우 iOS7 버전과 비슷한 모양과 느낌을 얻기 위해 노력하고 있습니다.tableView : viewForHeaderInSection 메서드가 iOS6에서만 호출 될 수 있습니까?
이제 iOS6에서 섹션의 headerView가 iOS7에서와 유사하게 보이기를 원합니다.
아래의 방법을 사용하면 iOS6에서 괜찮아 보입니다.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
if (sectionTitle == nil) {
return nil;
}
// Create label with section title
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont startProduktView_landLabelFont];
label.frame = CGRectMake(5, 6, 300, 30);
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor darkGrayColor];
label.shadowColor = [UIColor clearColor];
label.shadowOffset = CGSizeMake(0.0, 0.0);
label.text = sectionTitle;
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 21)];
[view addSubview:label];
return view;
}
그러나 지금 당면한 문제는 iOS7 버전에도 적용됩니다. 그러나 iOS 7 버전에서는 헤더가 표준으로 표시됩니다. 그래서 기본적으로 iOS7에서이 델리게이트 메소드가 전혀 호출되지 않는 방법이 있다면 좋을 것입니다. 이것이 가능한가?
감사합니다. @Wain! 다른 위임 클래스를 제공하는 것이 좋습니다. – riik