UITableViewのコード方法を学習しようとしていて、セクションのプログラミングにいくつかの問題があります。ネストされたNSArrayのUITableViewの異なるセクションヘッダー
私は3つの配列で文字列と1つの配列を持つ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