首页 > 移动平台 > 详细

iOS: Dictionary排序

时间:2016-09-17 12:08:19      阅读:266      评论:0      收藏:0      [点我收藏+]
NSArray *array = [[SCManager sharedManager].currentAlarmDic allValues];
    NSArray *arraySorted = [array sortedArrayUsingComparator:
                            ^NSComparisonResult(AlarmBean *obj1, AlarmBean *obj2) {
                                NSComparisonResult result = NSOrderedSame;
                                if (obj1.hour < obj2.hour) {
                                    result = NSOrderedAscending;
                                }else if (obj1.hour > obj2.hour) {
                                    result = NSOrderedDescending;
                                }
                                if (result == NSOrderedSame) {
                                    if (obj1.minute < obj2.minute) {
                                        result = NSOrderedAscending;
                                    }else if (obj1.minute > obj2.minute) {
                                        result = NSOrderedDescending;
                                    }
                                }
                                return result;  
                            }];
    AlarmBean *bean = (AlarmBean *)(arraySorted[indexPath.row]);

  

iOS: Dictionary排序

原文:http://www.cnblogs.com/makebetter/p/5878196.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!