读书人

AddressBookUI.Framwork使用之ABPeopl

发布时间: 2012-12-14 10:33:07 作者: rapoo

AddressBookUI.Framwork应用之ABPeoplePickerNavigationController

必须设置委托ABPeoplePickerNavigationControllerDelegate,ab.peoplePickerDelegate=self;

委托方法:

-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier

{

//点击联系人详情里面的属性,对相应的属性做处理

ABMultiValueRef values=ABRecordCopyValue(person, property);

CFIndex ix=ABMultiValueGetIndexForIdentifier(values, identifier);

CFStringRef value=ABMultiValueCopyValueAtIndex(values, ix);

NSLog(@"%@",value);

CFRelease(values);

CFRelease(values);

//获取某个值的标识器

CFIndex identifie=ABMultiValueGetIdentifierAtIndex(values, ix);

NSLog(@"identifier=%ld",identifie);

//限制用户可以看到的属性

peoplePicker.displayedProperties=[NSArrayarrayWithObject:[NSNumbernumberWithInt:kABPersonEmailProperty]];

returnNO;//默认操作为选择进入相应的应用程序,比如打电话就进入电话程序

}




读书人网 >移动开发

热点推荐