我需要使用项目字典的“日期”键对我的数组进行排序。最后,我需要具有某种结构的数组作为我的 mData 数组,但需要对日期进行排序。
mData---------->(
{
items = (
{
Accuracy = 5;
Address = "Australia, Sydney CBD, Bridge Street";
Course = "0.00";
Date = "2013-08-20 06:50:28 +0000";
Speed = 3;
alt = 0;
lat = "-33.8634";
lon = "151.211";
},
{
Accuracy = 65;
Address = "Armenia, Yerevan, \U053f\U0561\U056c\U0565\U0576\U0581\U056b \U0583\U0578\U0572\U0578\U0581";
Course = "0.00";
Date = "2013-08-20 06:41:02 +0000";
Speed = 3;
alt = 1116;
lat = "40.20016076";
lon = "44.49
在此处输入代码130268";
}
);
name = Name;
startTime = "10:40";
}
)
我的数组看起来像
2。NSDictionary * mFirst = [NSDictionary dictionaryWithObjectsAndKeys:[NSDate distantFuture], @"Date", nil];
NSDictionary * mSecond = [NSDictionary dictionaryWithObjectsAndKeys:[NSDate distantPast], @"Date", nil];
NSArray *mArr = [[NSArray alloc]initWithObjects:mFirst,mSecond, nil];
NSDictionary * myDict = [NSDictionary dictionaryWithObject:mArr forKey:@"items"];
NSArray * mSortedArray = [[ NSArray alloc]initWithObjects:myDict, nil];
NSLog(@"%@", mSortedArray);