【发布时间】:2018-04-10 03:16:17
【问题描述】:
我有一个NSMutableArray,如下:-
在我的UICollectionView numberOfItemsInSection 中,我如何获取attribute_name 的项目数?例如,在 attribute_group_name Color section 下,我会得到 4 个项目。
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.attributeGroupList[section].count; //HOW CAN I GET ITEM COUNT FOR ATTRIBUTE_NAME?
}
更新:-
具有新数据结构的示例输出:-
{
"attribute_group_name" = Color;
names = (
Black,
White,
Gold,
Red
);
},
{
"attribute_group_name" = Service;
names = (
"Free Shipping",
Insurance
);
},
{
"attribute_group_name" = Telco;
names = (
Digi,
Maxis,
Celcom
);
},
{
"attribute_group_name" = Material;
names = (
Wood
);
},
{
"attribute_group_name" = Brand;
names = (
Apple,
Mi,
Gome,
HuaWei
);
},
{
"attribute_group_name" = RAM;
names = (
4G,
8G,
16G
);
},
{
"attribute_group_name" = Size;
names = (
1200sqf,
908sqf
);
},
{
"attribute_group_name" = Location;
names = (
"Petaling Jaya",
"Kuala Lumpur",
Ipoh
);
},
{
"attribute_group_name" = Memory;
names = (
32G,
64G,
128G,
256G
);
},
{
"attribute_group_name" = Warranty;
names = (
"1 Year"
);
}
【问题讨论】:
-
你的字典设计得很糟糕。而不是拥有可变键,您应该有一个键,例如
attributes,它是Strings 或其他的数组。也请发布文字,而不是图片 -
您好 Paulw11,将注意帖子文本而不是图像。谢谢!
标签: ios objective-c uicollectionview