我使用ABPeoplePickerNavigationController
获取联系人,当我选择其中任何一个联系人时,我会使用ABPersonViewController
获取该人的详细信息。从Apple文档中,我们将使用ABPersonViewController
方法在allowsActions:
上获得面对时间按钮。但我没有得到面子。我使用了以下代码..
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person {
// NSLog(@"shouldContinueAfterSelectingPerson");
ABPersonViewController *picker = [[ABPersonViewController alloc] init] ;
picker.personViewDelegate = self;
picker.displayedPerson = person;
picker.displayedProperties=@[@(kABPersonPhoneProperty),@(kABPersonEmailProperty),@(kABPersonBirthdayProperty),@(kABPersonOrganizationProperty),@(kABPersonJobTitleProperty),@(kABPersonDepartmentProperty),@(kABPersonNoteProperty),@(kABPersonCreationDateProperty)];
picker.allowsActions=YES;
[self.navigationController pushViewController:picker animated:YES];}
答案 0 :(得分:0)
我得到了答案。我使用[self.navigationController pushViewController:picker animated:YES]
代替[peoplePicker pushViewController:picker animated:YES]
。这就是为什么我没有得到我想要的东西。原因是,当我写[self.navigationController pushViewController:picker animated:YES]
时,默认的ABPersonViewController
将会出现。所以facetime,shareContact和Add to Favorites按钮都不存在。但是当我写[peoplePicker pushViewController:picker animated:YES]
时,创建了自定义ABPersonViewController
,并且所有按钮都使用allowActions:方法。
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person {
ABPersonViewController *picker = [[ABPersonViewController alloc] init];
picker.personViewDelegate = self;
picker.displayedPerson = person;
picker.displayedProperties = peoplePicker.displayedProperties;
picker.allowsActions = YES;
[peoplePicker pushViewController:picker animated:YES];
return NO;
}