2012-05-01 20 views
2

の内側に私はABPersonViewControllerをサブクラス私のカスタムクラスに取り扱いクリックイベントABPersonViewController

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

デリゲートを実装しています。デリゲートメソッドは、ABPersonViewControllerサブクラス内のクリックイベントをキャッチしています。しかしどのフィールドが正確にクリックされたのかはどのように分かりますか?たとえば。私が自宅の住所フィールドをクリックすると、どのように私はデリゲートメソッド内のこのケースを処理します。

答えて

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などのような他のすべてのプロパティを確認することができます

関連する問題