0

我很快就知道如何从 CNContactPickerViewController 中选择生日标签,但我在 Objective-c 中有点困惑

在这里我使用如下代码:In Objective-c

如何在“didSelectContactProperty”方法中选择生日标签。你能帮帮我吗..

-(void)presentContacts {
    CNContactPickerViewController *picker = [[CNContactPickerViewController alloc] init];
    NSArray *propertyKeys = @[CNContactBirthdayKey, CNContactPhoneNumbersKey, CNContactGivenNameKey, CNContactFamilyNameKey, CNContactOrganizationNameKey];
    NSPredicate *enablePredicate = [NSPredicate predicateWithFormat:@"birthday != nil"];

    picker.displayedPropertyKeys = propertyKeys;
    picker.predicateForEnablingContact = enablePredicate;
    picker.delegate = self;

    [self presentViewController:picker animated:YES completion:nil];
}

- (void)contactPickerDidCancel: (CNContactPickerViewController *) picker {
    NSLog(@"didCancel");
}

- (void)contactPicker: (CNContactPickerViewController *) picker didSelectContact: (CNContact *)contact{    
    NSLog(@"didSelectContact");
}

- (void)contactPicker: (CNContactPickerViewController *) picker didSelectContactProperty: (CNContactProperty *)contactProperty{
     NSLog(@"didSelectProperty");
}
4

0 回答 0