Handling click events inside ABPersonViewController; not responding to clicks

164 views Asked by At

am using this function in my program for displaying contacts in my program. But when i click on the fields in the abpersonview nothing happens.

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

My class has an object of AbPersonView ,below is my class definition

 #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

and i am using this Currentpersonview as

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

But i cant get any respose on the function when i click on the ABPersonView.....

What might be the problem??

1

There are 1 answers

0
Luca Teti On

I suppose you need to set the delegate:

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

and implement the correspondent delegate method in the delegate class :

– personViewController:shouldPerformDefaultActionForPerson:property:identifier:

be sure to declare in the interface of this class too.