不说了 ,直接上代码。Talk is cheap , show me the code.
NSArray *stortedArray = [wkSelf.dataArray sortedArrayUsingComparator:^NSComparisonResult(NSDictionary *_Nonnull obj1, NSDictionary *_Nonnull obj2) {
NSLog(@"dateFromStringMore one%ld",[[PublicMethod dateFromStringMore:((XRArticleModel *)obj1).article.createTime] compare:[PublicMethod dateFromString:((XRArticleModel *)obj2).article.createTime]]);
NSLog(@"dateFromStringMore twow%ld",[[PublicMethod dateFromString:((XRArticleModel *)obj2).article.createTime] compare:[PublicMethod dateFromStringMore:((XRArticleModel *)obj1).article.createTime]]);
return [[PublicMethod dateFromStringMore:((XRArticleModel *)obj2).article.createTime] compare: [PublicMethod dateFromString:((XRArticleModel *)obj1).article.createTime]];
}];
NSArray *shitfucker = [wkSelf.dataArray sortedArrayUsingComparator:^NSComparisonResult(XRArticleModel *obj1, XRArticleModel *obj2) {
NSLog(@"shitfuckerOne = %ld",[[PublicMethod dateFromStringMore:obj2.article.createTime] compare:[PublicMethod dateFromStringMore:obj1.article.createTime ]]);
NSLog(@"shitfuckerTwo = %ld",[[PublicMethod dateFromStringMore:obj1.article.createTime ] compare:[PublicMethod dateFromStringMore:obj2.article.createTime]]);
return [[PublicMethod dateFromStringMore:obj2.article.createTime] compare:[PublicMethod dateFromStringMore:obj1.article.createTime ]];
}];
for (XRArticleModel *model in shitfucker) {
NSLog(@"shitfuckerOhYes =%@",model.article.createTime);
}
for (XRArticleModel *model in stortedArray) {
NSLog(@"stortedArray = %@",model.article.createTime);
}