UITableView를 코딩하는 방법을 배우려고하고 있으며 섹션 프로그래밍에 몇 가지 문제가 있습니다.중첩 된 NSArray의 UITableView에서 다른 섹션 헤더
나는 3 개의 배열로 문자열과 3 개의 배열로 3 개의 배열을 선언했다. 에
firstSection = [NSArray arrayWithObjects:@"Red", @"Blue", nil];
secondSection = [NSArray arrayWithObjects:@"Orange", @"Green", @"Purple", nil];
thirdSection = [NSArray arrayWithObject:@"Yellow"];
array = [[NSMutableArray alloc] initWithObjects:firstSection, secondSection, thirdSection, nil];
는 헤더
로 배열 자체 따라서 가능한 실제 이름을 사용 부분의 이름을 표시하는 표시 헤더
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
NSString * title;
title = [NSString stringWithFormat:@"%@" , [array objectAtIndex:section]];
return title;
}
를 도시 firstSection 및 secondSection과 같은 배열의?
나는 당신이 원하는 것을 정말로 이해하지 못합니다. - 배열의 이름입니다 (예 : "firstSection")? 또는 배열 안의 항목 (예 : "Red")? – SomaMan
예 배열 이름을 표시하고 싶습니다. – wakaka