我正在生成一个座位图,其中的等级意味着部分和座位,这意味着其中的单元格数量,但在此之前,有许多行可以容纳其中的座位数。但是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;
}