2012-05-01 6 views
2

안에 나는 ABPersonViewController 서브 클래스 내 사용자 정의 클래스에처리 클릭 이벤트 ABPersonViewController

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

대리자를 구현하고있다. 대리자 메서드는 ABPersonViewController 하위 클래스 내의 클릭 이벤트를 catch하고 있습니다. 그러나 정확히 어떤 필드가 클릭되었는지 어떻게 알 수 있습니까? 예를 들면. 집 주소 필드를 클릭하면 위임 메서드 내에서이 케이스를 어떻게 처리 할 것인가?

답변

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

그냥 kABPersonAddressProperty처럼 전화 번호, 이메일, URL 등과 같은 다른 모든 속성을 확인할 수 있습니다

관련 문제