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??
I suppose you need to set the delegate:
and implement the correspondent delegate method in the delegate class :
be sure to declare in the interface of this class too.