0
我將這三個數據存儲爲一個,如果用戶喜歡按照價格那麼,一切都應該是有序的。請幫我展示一下。我想存儲圖像,名稱,價格在一個陣列中,如果我對價格值進行排序,那麼名稱和圖像必須妥善安排
imgArr =[[NSArray alloc]init];
nameArr=[[NSArray alloc]init];
priceArr=[[NSArray alloc]init];
我用這樣的Json腳本。
{
image = "";
name = Blue;
"option_value_id" = 40;
price = 3;
"price_prefix" = "+";
"product_option_value_id" = 3;
quantity = 300;
subtract = 0;
weight = 3;
"weight_prefix" = "+";
},
{
image = "";
name = Green;
"option_value_id" = 41;
price = 1;
"price_prefix" = "+";
"product_option_value_id" = 1;
quantity = 100;
subtract = 0;
weight = 1;
"weight_prefix" = "+";
},
{
image = "";
name = Yellow;
"option_value_id" = 42;
price = 2;
"price_prefix" = "+";
"product_option_value_id" = 2;
quantity = 200;
subtract = 1;
weight = 2;
"weight_prefix" = "+";
}
你更好的做出數據分析類並取得一個對象,然後排序將可以適用,因爲你需要/想要 –
沒有鍵如何設置字典中的值? –
JSON無效,請參閱:[JSON簡介](http://json.org)。 – zaph