2011-03-25 6 views
2

UITableView의 섹션 제목을 다른보기 컨트롤러의 섹션 제목으로 푸시하고 싶습니다. 그러나 기존 섹션 제목을 읽는 방법을 알 수 없습니다. 기존 섹션 제목은 동적으로 구성되어 있으므로 다시 재구성하는 것보다 재사용하고 싶습니다.UITableView의 문자열 값보기 Section Title

if (indexPath.section == 0) { 

     SecondViewController *secondViewController = [[SecondViewController alloc] init]; 
     secondViewController.strValueHolder = FOO_section.sectionTitle; // FOO Code 
     [[self navigationController] pushViewController:secondViewController animated:YES]; 
     [secondViewController release]; 

} 

답변

8

사용자가 직접 titleForHeaderInSection 메소드를 호출 할 수 있습니다

NSString *sectionTitle = 
    [self tableView:tableView titleForHeaderInSection:indexPath.section]; 

또는 사용자 정의 방법에 titleForHeaderInSection 당신이 현재 가지고있는 코드를 이동하고 titleForHeaderInSection에서 해당 사용자 정의 방식과 다른를 밀고 장소를 호출 뷰 컨트롤러.

+0

답변 해 주셔서 감사합니다. 두 번째 옵션 인 custom 메서드를 사용하여 여러 위치에서 호출했습니다. –