2

I am implementing

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

delegate in my custom class which subclasses ABPersonViewController. The delegate method is catching the click events inside the ABPersonViewController subclass. But how will I know which field exactly has been clicked. For eg. if I click on the home address field, how will I handle this case inside the delegate method.

Xavi Valero
  • 2,047
  • 7
  • 42
  • 80

1 Answers1

2
- (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
if(property == kABPersonAddressProperty){
    ABMutableMultiValueRef multi = ABRecordCopyValue(person, property);
    CFStringRef address = ABMultiValueCopyValueAtIndex(multi, identifier);
    NSLog(@"Address %@", (NSString *)address);
    // Do your tasks here
    CFRelease(address);
}
return YES;
}

Just like kABPersonAddressProperty you can check all other properties like phone number, email, url etc.

Jean Paul
  • 2,389
  • 5
  • 27
  • 37