iOS --调用系统通讯录
2016-05-02 21:42
375 查看
// 调用系统通讯录需要遵循两个代理ABPeoplePickerNavigationControllerDelegate,UINavigationControllerDelegate 相关类为ABPeoplePickerNavigationController
// 系统通讯录自带导航栏,所有要model出来 // 初始化 ABPeoplePickerNavigationController *peoplePicker = [[ABPeoplePickerNavigationController alloc] init]; peoplePicker.peoplePickerDelegate = self; [self presentViewController:peoplePicker animated:YES completion:nil];
#pragma mark - ABPeoplePickerNavigationControllerDelegate - (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { ABMultiValueRef valuesRef = ABRecordCopyValue(person, kABPersonPhoneProperty); CFIndex index = ABMultiValueGetIndexForIdentifier(valuesRef,identifier); //电话号码 CFStringRef telValue = ABMultiValueCopyValueAtIndex(valuesRef,index); //全名 CFStringRef anFullName = ABRecordCopyCompositeName(person); [self dismissViewControllerAnimated:YES completion:^{ // (__bridge NSString *)telValue; // [NSString stringWithFormat:@"%@",anFullName]; NSLog(@"%@---%@",(__bridge NSString *)telValue,[NSString stringWithFormat:@"%@",anFullName]); }]; }
相关文章推荐
- iOS --归档存储自定义对象
- ios本地数据存取
- iOS AVPlayer 学习
- iOS 视图控制器转场详解
- 华硕fl5600l重装系统
- iOS中黄色文件夹和蓝色文件夹的区别
- iOS开发------使用Xcode编译器定位抛出异常的位置
- iOS开发中,tintColor和 backgroundColor的区别
- iOS中代码性能测试的方法
- BIOS 深入学习 转
- 《Motion Design for iOS》(七)
- iOS 开发小技巧
- iOS视图控制器编程指南 --- 实现一个容器视图控制器
- iOS-View视图的生命历程
- iOS 上传自己的库到cocoapod
- BIOS、MBR、PBR等基础知识,兼谈U盘、移动硬盘以及操作系统的安装与启动基本原理
- XCode iOS Simulator 模拟器
- iOS CMTimeMake 和 CMTimeMakeWithSeconds 学习
- iOS AFNetworking使用技巧与问题
- iOS AFNetworking使用技巧与问题