0

我使用联系人获取联系人ABPeoplePickerNavigationController,当我选择其中任何一个联系人时,我会获取该人使用的详细信息ABPersonViewControllerABPersonViewController从苹果文档中,我们将获得有关使用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];}
4

1 回答 1

0

我得到了答案。我用过[self.navigationController pushViewController:picker animated:YES]而不是[peoplePicker pushViewController:picker animated:YES]. 这就是为什么我没有得到我想要的。原因是,当我写[self.navigationController pushViewController:picker animated:YES]的时候,默认ABPersonViewController就会出现。所以没有 facetime、shareContact 和 Add to Favorites 按钮。但是当我编写时,使用allowActions:方法[peoplePicker pushViewController:picker animated:YES]创建了自定义和所有按钮。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;
    }
于 2013-11-25T09:49:55.527 回答