セクションを意味するレベルとセルの数を意味する座席を持つ座席マップを生成していますが、その前に座席数を保持する行の数があります。しかしUICollectionView
、そこにはセクションとセルしかありません。行で管理する方法。各セクションにはセルがありますが、行の下に表示する方法は、各セクションに行数があることを意味します。セクションとセルを表示できますが、行は表示できません。以上をご案内いたします。
前もって感謝します。
これはJSONです
{
Level1:
{
row1:
{
1: "on",
2: "on",
3: "on",
4: "on",
5: "on",
6: "on",
7: "on",
8: "on",
9: "on",
10: "on",
attr: {
total: "10",
type: "gold"
}
},
row2: {
1: "on",
2: "on",
3: "on",
4: "on",
5: "on",
6: "on",
7: "on",
8: "on",
9: "on",
10: "on",
attr: {
total: "10",
type: "gold"
}
}
},
Level3: {
row1: {
1: "on",
2: "on",
3: "on",
4: "on",
5: "on",
6: "on",
7: "on",
8: "on",
9: "on",
10: "on",
attr: {
total: "10",
type: "silver"
}
}
}
}
セクションの数としてレベルを示すjsonの上で、私の質問はセルを行に表示する方法です。
私がやっている方法は次のとおりです。
- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView
{
NSLog(@"levels count:%d", [arrLevels count]);
return [arrLevels count];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
NSLog(@"vals count:%d", [arrSeats count]);
for(int i=0; i<[arrLevels count]; i++)
{
if(section == i)
{
int c;
NSString *cnt = [NSString stringWithFormat:@"%@",[arrSeats objectAtIndex:i]];
c = [cnt intValue];
return c;
}
}
return 1;
}