0
私はUITableView
とUICollectionView
を内部に持っています。私はこれをDescend(Latest Post First)と並べ替えたいと思っていました。どのようにしたいのですか?私はいくつかの方法を試しましたが、すべてが機能していません。続きIDまたは月ごとに配列をソートする方法:降順(最新のポストファースト)?
は私のコードと応答
[Utilities serverRequest:@{@"getAnnouncement":@"a6dba37437ced2c3b07469fd6c0661f3"} completionBlock:^(id response) {
collectionViewDic[@"announcement"] = response[@"response"];
_annArray = response[@"response"];
NSLog(@"AnnouncementResponse%@",response);
// sorting to newest
/*
NSSortDescriptor *sortDescriptor;
sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"anc_id" ascending:NO];
NSMutableArray *sortDescriptors = [NSMutableArray arrayWithObject:sortDescriptor];
[_annArray sortedArrayUsingDescriptors:sortDescriptors];
NSLog(@"Sorted - AnnouncementResponse%@",response);
*/
/*
NSSortDescriptor* sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"anc_id" ascending:NO];
NSArray* sortedArray = [_annArray sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
NSLog(@"Sorted Array Response -%@",sortedArray);
*/
announcmentDone = YES;
if (newsDone && bulletInDone && announcmentDone && !refreshed) {
refreshed = YES;
[table reloadData];
}
} errorBlock:nil];
私の回答に応じて私にコードを提案してください.. – Fido