IOS汉字排序


    
    NSLocale *strokeSortingLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh@collation=pinyin"];
    NSArray  *sortArr  = [self.dataArray sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        return [[obj1 objectForKey:@"name"] compare:[obj2 objectForKey:@"name"] options:0 range:NSMakeRange(0, [[obj1 objectForKey:@"name"] length]) locale:strokeSortingLocale];
    }];

你可能感兴趣的:(IOS)