1

谁能建议如何对包含对象的数组进行排序,例如:

    "abd",
    “kkkkkkkkkkkkkkkkkk”,
    “取 1”,
    “拿 10”,
    “拿 11”,
    “拿 12”,
    “拿 13”,
    “拿 14”,
    “拿 15”,
    “拿 16”,
    “拿 17”,
    “拿 18”,
    “拿 2”,
    “拿 4”,
    “拿 5”,
    “拿 6”,
    “拿8”

按升序对数组进行排序,使“Take 2”排在“Take 1”之后。

4

1 回答 1

1

您可以在数组上使用排序选择器:

NSArray *sortedArray = [yourArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
于 2012-08-29T12:54:36.863 回答