views:

26

answers:

1

I'm trying to implement a view similar to contacts view in iPhone Message (SMS) app. When composing a message on iPhone, there will be "+" button to add contacts. On click of "+", it will show list of contacts and just by selecting a contact, it will add the contact name in "To" text field. I found following code to show contacts. But on click of a contact, its showing more details about the contact and just not selected.

    ABPeoplePickerNavigationController* picker;
picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;

CGRect newFrame = picker.view.frame;
newFrame.size.height = newFrame.size.height - 49;
picker.view.frame = newFrame;

[self presentModalViewController:picker animated:NO];
[picker release];

Can some body point out me correct way to select a contact?

A: 

I found the solution. I've to implement the delegate methods to handle that. The following are the delegate methods

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {

[self dismissModalViewControllerAnimated:YES];

}

- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person 

{ . . . . [self dismissModalViewControllerAnimated:YES];

return NO;

}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person 
                            property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier

{
return NO; }

Satyam svv