Skip to content

Sort the name array model by A-Z. 对App中的联系人数组模型进行排序.

License

Notifications You must be signed in to change notification settings

zedxpp/PPNameSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PPNameSort

对App中的联系人数组模型进行排序.

使用方式

1 #import "PPNameSort.h"

2 创建模型(从服务器)

NSMutableArray *arr = [NSMutableArray array];
PPObject *model = [PPObject new];
model.nickName = @"啦啦";
[arr addObject:model];

3 将模型数组导入并获取回调

arr 模型数组
@"nickName" 需要排序的模型属性名
sortedModelDict 回调

[PPNameSort sortWithModels:arr sortPropertyNameString:@"nickName" sortedModelDict:^(NSMutableDictionary<NSString *,NSMutableArray *> *sortedModelDict, NSMutableArray *nameKeys) {
        NSLog(@"sortedModelDict = %@", sortedModelDict);
        NSLog(@"nameKeys = %@", nameKeys);
}];

4 最终获取到的数据

2017-06-26 17:31:45.532 PPNameSort[7814:261673] sortedModelDict = {
    "#" =     (
        "<PPObject: 0x60000001ce00>",
        "<PPObject: 0x60000001cec0>"
    );
    A =     (
        "<PPObject: 0x60000001ceb0>"
    );
    L =     (
        "<PPObject: 0x60000001cd80>"
    );
    S =     (
        "<PPObject: 0x60000001cdb0>"
    );
}
2017-06-26 17:31:45.532 PPNameSort[7814:261673] nameKeys = (
    A,
    L,
    S,
    "#"
)

本项目根据 PPGetAddressBook 框架进行简单修改后提取出来的. 已保留原项目的注释.

About

Sort the name array model by A-Z. 对App中的联系人数组模型进行排序.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published