我使用ABPeoplePickerNavigationController获取联系人,当我选择这些联系人中的任何一个时,我都会使用ABPersonViewController获取该联系人的详细信息。从苹果文档中,我们将使用allowsActions:方法获得ABPersonViewController上的face time button。但是我没有得到面对面的时间。我使用了以下代码..
- (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];}发布于 2013-11-25 17:49:56
我有答案了。我使用了[self.navigationController pushViewController:picker animated:YES]而不是[peoplePicker pushViewController:picker animated:YES]。这就是为什么我没有得到我想要的。原因是,当我写[self.navigationController pushViewController:picker animated:YES]时,默认的ABPersonViewController会是come。所以facetime,shareContact和添加到收藏夹的按钮都不存在。但是当我编写[peoplePicker pushViewController:picker animated:YES]时,创建了自定义方法,并且所有的按钮都使用allowsActions:ABPersonViewController。
- (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;
}https://stackoverflow.com/questions/20186740
复制相似问题