2013-11-25 92 views
0

我使用ABPeoplePickerNavigationController獲取聯繫人,當我選擇這些聯繫人中的任何一個時,我使用ABPersonViewController獲取該人的詳細信息。從蘋果文件中,我們將使用allowsActions:方法獲取ABPersonViewController上的時間按鈕。但我沒有得到時間。我已經使用以下代碼..ABPersonViewController沒有顯示facetime按鈕?

- (BOOL)peoplePickerNavigationController: 
(ABPeoplePickerNavigationController *)peoplePicker 
shouldContinueAfterSelectingPerson:(ABRecordRef)person { 
// NSLog(@"shouldContinueAfterSelectingPerson"); 
ABPersonViewController *picker = [[ABPersonViewController alloc] init] ; 
picker.personViewDelegate = self; 
picker.displayedPerson = person; 
[email protected][@(kABPersonPhoneProperty),@(kABPersonEmailProperty),@(kABPersonBirthdayProperty),@(kABPersonOrganizationProperty),@(kABPersonJobTitleProperty),@(kABPersonDepartmentProperty),@(kABPersonNoteProperty),@(kABPersonCreationDateProperty)]; 
picker.allowsActions=YES; 
[self.navigationController pushViewController:picker animated:YES];} 

回答

0

我得到了答案。我用而不是[peoplePicker pushViewController:picker animated:YES]。這就是爲什麼我沒有得到我想要的。原因是,當我寫,默認ABPersonViewController將會來。所以facetime,shareContact和添加到收藏夾按鈕不存在。但是當我寫[peoplePicker pushViewController:picker animated:YES],創建自定義ABPersonViewController和所有按鈕都在使用allowsActions:方法。

- (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; 
    }