iOS实现封装一个获取通讯录的工具类详解

2020-01-21 02:02:22于海丽

使用


#import "ContactsHelp.h"
#import "ContactsModel.h"

...

@property(nonatomic, strong) ContactsHelp *contactsHelp;

...

- (IBAction)btn_getOne {
 self.contactsHelp = [[ContactsHelp alloc] init];
 [self.contactsHelp getOnePhoneInfoWithUI:self callBack:^(ContactsModel *contactModel) {
  NSLog(@"-----------");
  NSLog(@"%@", contactModel.name);
  NSLog(@"%@", contactModel.num);
 }];
}

- (IBAction)btn_getAll {
 NSMutableArray *contactModels = [ContactsHelp getAllPhoneInfo];
 [contactModels enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  ContactsModel *model = obj;
  NSLog(@"-----------");
  NSLog(@"%@", model.name);
  NSLog(@"%@", model.num);
 }];
}

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对ASPKU的支持。


注:相关教程知识阅读请移步到IOS开发频道。