0
votes

i am trying to open ABPersonViewController at 'didSelectRowAtIndexPath:' method. But when i click on one of my record in table view it donot show anything.I am not able to configure out where is the problem. Where 'people' is array having contact name. here is my code:

 (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {


    ABRecordRef person = (ABRecordRef)[people objectAtIndex:indexPath.row];
    ABPersonViewController *pvc = [[ABPersonViewController alloc] init];
    pvc.personViewDelegate = self;
    pvc.displayedPerson = person;
    [self.navigationController pushViewController:pvc animated:YES];
    [pvc autorelease];
}

- (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person 
                    property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue
{
    return NO;
}

1
What is happening? Does the push take place to display an empty view. If no push is taking place, pls ensure that the viewcontroller has a navigationControllervisakh7
@7kv7: should i add navigation controller in IB or in my code...?user720235
Thats up to you to decide. You can choose to have a navigation controller in ur IB to control the navigation or create one programmaticallyvisakh7
@7kv7: can u show me how to do programmatically.user720235

1 Answers

1
votes

You need to set displayedProperties. It is NULL by default.

For example,

     picker.displayedProperties = [NSArray arrayWithObject:
          [NSNumber numberWithInt:kABPersonAddressProperty]];