2

如何解除 ABPersonViewController?这是我的代码

 #pragma mark - Edit Record Method

-(void)btnEditContactTapped:(id)sender {

    // Fetch the address book 
    ABAddressBookRef addressBook = ABAddressBookCreate();

    ABRecordID recID = ABRecordGetRecordID(record);

    ABRecordRef record1 = ABAddressBookGetPersonWithRecordID(addressBook,recID);

    ABPersonViewController *personViewController = [[ABPersonViewController alloc]init];
    // set delegate
    personViewController.personViewDelegate = self;

    // Allow editing info
    personViewController.allowsEditing = YES;

    // Display contact info of selected person
    personViewController.displayedPerson = record1;

    // Person view controllers must be used with a navigation controller in order to function properly.
    UINavigationController *nc = [[UINavigationController alloc]
                                  initWithRootViewController:personViewController];
    [self presentModalViewController:nc animated:YES];
    [personViewController release];

}

#pragma mark - ABPersonViewControllerDelegate Method

- (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue {

    [self dismissModalViewControllerAnimated:YES];
    return NO;
}

记录在我的 ivar 中,声明为 .h 文件中的 ABRecordRef 记录。ABPersonViewControllerDelegate 方法永远不会被调用?怎么了?任何形式的帮助表示赞赏。谢谢

4

1 回答 1

0

您是否在项目的 .h 中实施了这些协议..?

< ABPeoplePickerNavigationControllerDelegate,
                                                                 ABPersonViewControllerDelegate,
                                                                 ABNewPersonViewControllerDelegate,
                                                                 ABUnknownPersonViewControllerDelegate>
于 2012-04-18T11:57:52.690 回答