首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

AddressBookUI.Framwork使用之ABPeoplePickerNavigationController

2012-12-14 
AddressBookUI.Framwork应用之ABPeoplePickerNavigationController 必须设置委托ABPeoplePickerNavigation

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;//默认操作为选择进入相应的应用程序,比如打电话就进入电话程序

}




热点排行