iOS 数组按内部元素属性排序

//对item按照时间进行排序
-(void)SortItem
{
    [m_pOldItemArray sortUsingComparator:^NSComparisonResult(GZhHaoArticleItem *obj1, GZhHaoArticleItem *obj2) {
        if ([obj2->pstrATime longLongValue] > [obj1->pstrATime longLongValue])
        {
            return NSOrderedDescending;
        }
        else if ([obj2->pstrATime longLongValue] == [obj1->pstrATime longLongValue])
        {
            return NSOrderedSame;
        }
        else
        {
            return NSOrderedAscending;
        }
    }];

你可能感兴趣的:(iOS 数组按内部元素属性排序)