I use the TTMessageController from Three20 to display a view that开发者_如何学编程 is similar to the iPhone SMS application containing a recipient picker.
Currently I am able to autosearch contacts and to browse them by clicking on the + button:
However I have a problem to apply the selected contact to the recipient field. TTMessageController implements the addRecipient method but I am not sure how to use it.
In my controller class that extends TTMessageController I have following method which is triggered when a contact is selected, so addRecipient has to go here somewhere:
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person{
//dismiss the contact selector
[self dismissModalViewControllerAnimated:NO];
return NO;
}
Any idea how to add the recipient in that method?
Add a single item from your datasource to the recipient field. So if your datasource has an array of strings (names) you call addRecipient: with a string. The index is where you want to insert the recipient in the field.
Post your datasource implementation and I will completely your code.
精彩评论