我在swift中知道如何从CNContactPickerViewController中选择生日标签,但我在Objective-c中有点混淆
这里我使用的代码如下:在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");
}