0

次のコードで見逃したものはありますか? リストを作成できますが、リストはUITableView. リストが表示されていますが、セクションのタイトルは「A」のみを指しています

ここに画像の説明を入力

arr_indexpeople> A、B、C、D、E.....Z の配列

arr_completeArray> 人のリストの配列

ありがとうございました。

4

3 に答える 3

4

return [arr_indexpeople objectAtIndex:section]

于 2013-01-24T05:05:47.987 に答える
3

titleForHeaderInSection で objectAtIndex 0 を返しています。に変更します-

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
      return [arr_indexpeople objectAtIndex:section]
}
于 2013-01-24T05:14:21.050 に答える
2

datasource メソッドは、セクションをロードするたびに呼び出されるため、以下に示すように、セクションの動的インデックスを arr_indexpeople の入力変数として指定します。

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
  return [arr_indexpeople objectAtIndex:section]
}
于 2013-01-24T06:04:54.297 に答える