Обработка событий нажатия внутри ABPersonViewController; не отвечает на клики

Я использую эту функцию в моей программе для отображения контактов в моей программе. Но когда я нажимаю на поля в abpersonview, ничего не происходит.

- (BOOL)personViewController:(ABPersonViewController *) personViewControllershouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
        {
            NSLog(@"IN");
                return YES;
        }

У моего класса есть объект AbPersonView, ниже мое определение класса

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




         @interface ContactTable : UIViewController<UITableViewDataSource,UISearchBarDelegate,UITableViewDelegate,ABNewPersonViewControllerDelegate,UIAlertViewDelegate,ABPersonViewControllerDelegate>

         @property  CFMutableArrayRef  filteredData;

            @property  CFArrayRef contactAdd;

            @property ABRecordRef person;

            @property ABAddressBookRef addressBook;

            @property ABPersonViewController *currentPersonView;

            @property (weak, nonatomic) IBOutlet UISearchBar *contactSearchBar;

            @property (weak, nonatomic) IBOutlet UITableView *contactTableView;

            @end

и я использую это Currentpersonview как

 self.currentPersonView=[[ABPersonViewController alloc]initWithNibName:@"ContactTable.h" bundle:nil];

        if(isFiltered)

            self.person=CFArrayGetValueAtIndex(self.filteredData,indexPath.row);

        else

            {
            NSLog(@"%ld index:%d", CFArrayGetCount(self.contactAdd),indexPath.row);
            self.person=(ABRecordRef)CFArrayGetValueAtIndex(self.contactAdd,indexPath.row);
            }

        self.currentPersonView.displayedPerson=&(*self.person);


        self.currentPersonView.allowsEditing=YES;

        self.currentPersonView.allowsActions=YES;

        [self.navigationController pushViewController:self.currentPersonView animated:YES];

Но я не могу получить какое-либо изменение в функции, когда я нажимаю на ABPersonView.....

В чем может быть проблема??

1 ответ

Я полагаю, вам нужно установить делегата:

 self.currentPersonView.personViewDelegate = self;//or some other class...

и реализовать соответствующий метод делегата в классе делегата:

– personViewController:shouldPerformDefaultActionForPerson:property:identifier:

Обязательно объявите в интерфейсе этого класса тоже.

Другие вопросы по тегам