数组套字典排序

 1 {
 2     "status": "1",
 3     "msg": "\u6210\u529f",
 4     "data": {
 5         "detail_data": [{
 6             "stock_code": "430074",
 7             "now_price": 14.07,
 8             "increase": "1.3%",
 9             "open": 13.89,
10             "general_capital": "108750000",
11             "close": 14.07,
12             "high": 14.14,
13             "low": 13.89,
14             "date": "2015-11-25",
15             "vol": 723500,
16             "amount": 10169420
17         }, {
18             "stock_code": "430074",
19             "now_price": 13.93,
20             "increase": "5.29%",
21             "open": 13.23,
22             "general_capital": "108750000",
23             "close": 13.93,
24             "high": 14.21,
25             "low": 13.21,
26             "date": "2015-11-23",
27             "vol": 513000,
28             "amount": 7116860
29         }, {
30             "stock_code": "430074",
31             "now_price": 13.85,
32             "increase": "-0.93%",
33             "open": 13.98,
34             "general_capital": "108750000",
35             "close": 13.85,
36             "high": 14.3,
37             "low": 13.5,
38             "date": "2015-11-24",
39             "vol": 538000,
40             "amount": 7546040
41         }],
42         "date_data": ["2015-11-04", "2015-11-05", "2015-11-06", "2015-11-09", "2015-11-10", "2015-11-11", "2015-11-12", "2015-11-13", "2015-11-16", "2015-11-17", "2015-11-18", "2015-11-19", "2015-11-20", "2015-11-23", "2015-11-24", "2015-11-25", "2015-11-26", "2015-11-27", "2015-11-30", "2015-12-01", "2015-12-02", "2015-12-03"]
43     }
44 }

 

^^^^^^数据源

方法下面

 1 -(void) setDatas{
 2     NSMutableArray *detailArray = [NSMutableArray arrayWithArray:[[all_Dic objectForKey:@"data"] objectForKey:@"detail_data"]];
 3     NSLog(@"detailArray=%@",detailArray);
 4 
 5     NSSortDescriptor*sorter=[[NSSortDescriptor alloc]initWithKey:@"date" ascending:YES];
 6     NSMutableArray *sortDescriptors=[[NSMutableArray alloc]initWithObjects:&sorter count:1];
 7     NSArray *sortArray=[detailArray sortedArrayUsingDescriptors:sortDescriptors];
 8     NSLog(@"sortArray==%@",sortArray);
 9 
10     
11 }

 

转载于:https://www.cnblogs.com/-yun/p/5033301.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值