我在我的字段“日期”上排序NSMutableArray,但它没有考虑到时间。如果日期相同,则时间仍然是随机排序的。我究竟做错了什么? “日期”字段的类型是NSDate。数组排序日期,但没有按时排序
NSSortDescriptor *dateDescriptor =
[[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES];
NSArray *descriptors = [NSArray arrayWithObjects:dateDescriptor, nil];
[self.player1ScoreT sortedArrayUsingDescriptors:descriptors];
我的输出是:
2012年11月25日11:01:00 +0000
2012年11月25日11时零零分56秒+0000
2012年11月25日11:00: 54 +0000
2012年11月25日11时01分03秒+0000
奇怪.....
是你错过了任务 - 忽略了 - 我甚至尝试过排序我自己不相信这个:D谢谢 –
Thanx!这样可行! – RobertvdBerg