下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
框架:AddressBook、AddressBookUIABPeoplePickerNavigationControllerDelegateABPeoplePickerNavigationController *peoplePicker = [[ABPeoplePickerNavigationController alloc] init];peoplePicker.peoplePickerDelegate = self;[self presentVIEwController:peoplePicker animated:YES completion:nil];#pragma mark - ABPeoplePickerNavigationControllerDelegate协议方法-(BOol)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property IDentifIEr:(ABMultiValueIDentifIEr)IDentifIEr{ ABMultiValueRef valuesRef = ABRecordcopyValue(person,kABPersonPhoneProperty); CFIndex index = ABMultiValueGetIndexForIDentifIEr(valuesRef,IDentifIEr); //电话号码 CFStringRef telValue = ABMultiValuecopyValueAtIndex(valuesRef,index); //读取firstname //获取个人名字(可以通过以下两个方法获取名字,第一种是姓、名;第二种是通过全名)。 //第一中方法 // CFTypeRef firstname = ABRecordcopyValue(person,kABPersonFirstnameProperty); // CFTypeRef lastname = ABRecordcopyValue(person,kABPersonLastnameProperty); // //姓 // Nsstring * nameString = (__brIDge Nsstring *)firstname; // //名 // Nsstring * lastString = (__brIDge Nsstring *)lastname; //第二种方法:全名 CFStringRef anFullname = ABRecordCopycompositename(person); [self dismissVIEwControllerAnimated:YES completion:^{ NSLog(@"name %@,phone %@",anFullname,(__brIDge Nsstring *)telValue); //去掉- NSLog(@"%@",[(__brIDge Nsstring *)telValue stringByReplacingOccurrencesOfString:@"-" withString:@""]); }]; [self dismissVIEwControllerAnimated:YES completion:nil]; return NO;}//Cancel 按钮-(voID)peoplePickerNavigationControllerDIDCancel:(ABPeoplePickerNavigationController *)peoplePicker{ [self dismissVIEwControllerAnimated:YES completion:nil];}
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的系统通讯录的获取全部内容,希望文章能够帮你解决系统通讯录的获取所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)