【问题标题】:ABPersonViewController is not showing facetime button?Person ViewController 没有显示 facetime 按钮?
【发布时间】:2013-11-25 17:49:55
【问题描述】:

我使用ABPeoplePickerNavigationController 获取联系人,当我选择其中任何一个联系人时,我会使用ABPersonViewController 获取该人的详细信息。从苹果文档中,我们将使用allowsActions: 方法获得ABPersonViewController 上的面部时间按钮。但我没有得到面子时间。我使用了以下代码..

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

【问题讨论】:

    标签: ios abaddressbook abpersonviewcontroller facetime


    【解决方案1】:

    我得到了答案。我使用了[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;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-28
      • 1970-01-01
      • 2020-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多