处理ABPersonViewController中的点击事件



我正在实现

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

在我的自定义类中委托哪些子类ABPersonViewController .委托方法正在捕获ABPersonViewController子类中的单击事件。但是我怎么知道确切地点击了哪个字段。例如。如果我单击家庭地址字段,我将如何在委托方法中处理这种情况。

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

就像kABPersonAddressProperty一样,您可以检查所有其他属性,例如电话号码,电子邮件,URL等。

最新更新