動的データを含むテーブルを作成しようとしていますが、行き詰まっています。これが私のデータの構造です:
NSMutableArray *bigArray;
bigArray
には多くのNSDictionary
アイテムがあります。
それぞれitems
にエントリが 1 つだけあります。
sectionName
がキー、NSMutableArray が値です。
value
NSMutableArrayには多くのオブジェクトがあります。
これをできるだけ簡単に説明しようとしましたが、ここで行き詰まった部分です。
//easy
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [bigArray count];
}
//medium
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [[[[bigArray objectAtIndex:section] allValues] objectAtIndex:0] count];
}
現在のデータ構造に基づいてこのメソッドを実装する方法をこの部分で理解できません:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"MyCell"];
MyObject *obj = //Need this part
cell.textLabel.text = obj.name;
return cell;
}
簡単に言えば、動的データを含む動的セクションを挿入しようとしています。経験豊富な開発者からのアドバイスを探しています。これにどのように取り組みますか?