views:

509

answers:

2

Hello,

for my iPhone Project, I woud love to use the TTpickerTextField from Three20 to let the User select a contact from the Addressbook. While I’m really new to cocoa, I don’t understand how to use the Addressbook as a DataSource. As far as I understand, I have to create my own DataSource, that means, get every entry from the Addressbook and put it in my own DataSource, correct? But what Delegate/Protocol do I have to implement in my class, so that my class is a DataSource? Or am I on the wrong way? Can someone give me a hint?

Thank you so much

dragi

+5  A: 

This is just from looking at the headers, but TTPickerTextField is a subclass of TTSearchTextField, which has this property:

@property(nonatomic,retain) id<TTTableViewDataSource> dataSource;

So, I would expect that your custom object should adopt the TTTableViewDataSource protocol.

Ken
Could you maybe post a example on how you implemented the TTTableViewDataSource protocol to make it work with the Addressbook, Im a newbie and cant figure it out.
Neigaard
+1  A: 

As Ken says, you'll want a class that implements the protocol TTTableViewDataSource, and then to set an instance of that class as your field's dataSource property.

Additionally, you'll want to review the Address Book Programming Guide for iPhone OS, which will point you to the APIs you need to get data out of the Address Book itself in your datasource class.

Sixten Otto