2010-07-01 57 views
1

我想在ABPeoplePickerNavigationController中顯示聯繫人的已過濾列表,應該顯示擁有其電子郵件地址的人員以及不具有電子郵件地址的人員不​​在列表中,任何人都知道如何執行此操作?ABAddressBook已篩選的聯繫人

在此先感謝。

回答

0

嗨,你可以使用peoplePickerNavigationController代表要做到這一點

-(BOOL)peoplePickerNavigationController: 
(ABPeoplePickerNavigationController *)peoplePicker 
shouldContinueAfterSelectingPerson:(ABRecordRef)person 
{ 
    if(!ABRecordCopyValue(person,kABPersonEmailProperty) //Check if email field is empty 
    { 
     [peoplePicker dismissModalViewControllerAnimated:NO]; //dismiss the person with email field empty 
    } 
    return YES; 
    } 
} 

不要忘了你的界面與標籤.h文件

即添加委託,

#import <UIKit/UIKit.h> 
#import <AddressBook/AddressBook.h> 
#import <AddressBookUI/AddressBookUI.h> 

@interface ViewController : UITableViewController<ABNewPersonViewControllerDelegate,ABPeoplePickerNavigationControllerDelegate,ABPersonViewControllerDelegate,UIAlertViewDelegate> 
相關問題