我想添加@" Color",@" size",@" Product_Img"密钥'值为不同键的不同NSMutable数组
我的NSDictionary结构是....
{
Color = (
{
"color_name" = Red;
id = 1;
},
{
"color_name" = Black;
id = 2;
},
{
"color_name" = white;
id = 3;
},
{
"color_name" = Pink;
id = 4;
},
{
"color_name" = Green;
id = 5;
}
);
"Product_Img" = (
{
"product_image" = "15131445991.jpg";
"product_image_id" = 94;
}
);
"product_type" = product;
size = (
{
size = "6 Kg";
},
{
size = "7 Kg";
},
{
size = "8 Kg";
},
{
size = "9 Kg";
}
);
}
我的代码是我尝试实现的......
viewDidLoad中
self.arrProductSizeList = [NSMutableArray array];
self.arrProductColorList = [NSMutableArray array];
self.arrProductImageList = [NSMutableArray array];
configureData方法中的...
[self.arrProductImageList removeAllObjects];
[self.arrProductImageList addObjectsFromArray:[_dictProductDetails objectForKey:@"Product_Img"]];
[self.arrProductColorList removeAllObjects];
[self.arrProductColorList addObjectsFromArray:[_dictProductDetails objectForKey:@"Color"]];
[self.arrProductSizeList removeAllObjects];
[self.arrProductSizeList addObjectsFromArray:[_dictProductDetails objectForKey:@"size"]];
...的NSLog
NSLog(@"Size Array List%@", _arrProductSizeList);
NSLog(@"Color Array List%@", _arrProductColorList);
NSLog(@"Image Array List%@", _arrProductImageList);
提前致谢
答案 0 :(得分:0)
也许你可以试试这些代码:
self.arrProductSizeList = [_dictProductDetails [@“Product_Img”] mutableCopy];
self.arrProductColorList = [_dictProductDetails [@“Color”] mutableCopy];
self.arrProductImageList = [_dictProductDetails [@“size”] mutableCopy];