-3

我想对这个数组进行排序。在标题子字典的 _content 字段中按字母升序排列。

$1 = 0x0a2654c0 <__NSArrayM 0xa2654c0>(
    {
        "can_comment" = 0;
        "count_comments" = 0;
        "count_views" = 0;
        "date_create" = 1382375149;
        "date_update" = 1382375192;
        description =     {
            "_content" = "";
        };
        farm = 4;
        id = 72157636802321975;
        "needs_interstitial" = 0;
        photos = 3;
        primary = 10406280064;
        secret = 9731b9f97a;
        server = 3767;
        title =     {
            "_content" = Outdoors;
        };
        videos = 0;
        "visibility_can_see_set" = 1;
    },
    {
        "can_comment" = 0;
        "count_comments" = 0;
        "count_views" = 0;
        "date_create" = 1382374546;
        "date_update" = 1382374548;
        description =     {
            "_content" = "";
        };
        farm = 8;
        id = 72157636801994055;
        "needs_interstitial" = 0;
        photos = 10;
        primary = 10406216685;
        secret = 484f085b6d;
        server = 7420;
        title =     {
            "_content" = Cuba;
        };
        videos = 0;
        "visibility_can_see_set" = 1;
    },
    {
        "can_comment" = 0;
        "count_comments" = 0;
        "count_views" = 0;
        "date_create" = 1382374276;
        "date_update" = 1382374279;
        description =     {
            "_content" = "";
        };
        farm = 3;
        id = 72157636802362284;
        "needs_interstitial" = 0;
        photos = 6;
        primary = 10406175565;
        secret = f063b11d3e;
        server = 2839;
        title =     {
            "_content" = Afghanistan;
        };
        videos = 0;
        "visibility_can_see_set" = 1;
    },
  .....
 there are more than 50 element
4

1 回答 1

0

尝试这个

   NSArray *sortedArray = [unsortedArray sortedArrayUsingDescriptors:[NSArray arrayWithObjects:[NSSortDescriptor sortDescriptorWithKey@"description._content" ascending:YES],nil];
于 2013-10-26T06:15:07.307 回答