2011-12-21 3 views
0

섹션이있는 UITableView을 설정 중입니다. numberOfSectionsInTableView: 메서드가 제대로 호출되고 올바른 결과 (내 경우 3)를 반환하지만 titleForHeaderInSection은 전혀 호출되지 않고 결과 테이블 뷰에는 행이 있지만 섹션은 포함되지 않습니다.UITableViewDataSource 프로토콜을 구현할 때 titleForHeaderInSection이 호출되지 않음

이 방법이 tableview에 의해 호출되는지 확인하는 방법이 있습니까?

- (NSString *) titleForHeaderInSection:(NSInteger)section 
{   
    NSString *sectionHeader = nil; 

    if (section == 0) 
    { 
     sectionHeader = @"Alpha"; 
    } 
    if (section == 1) 
    { 
     sectionHeader = @"Beta"; 
    } 
    if (section == 2) 
    { 
     sectionHeader = @"Gamma"; 
    } 

    NSLog(@"%@", sectionHeader); 

    return sectionHeader; 
} 

답변

2

방법 서명이 방법은 첫 번째 매개 변수 tableView 누락하고 전화를받을 수 없습니다 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section입니다 : 여기

의 구현입니다.

관련 문제