Tutorial :Use Address Book as Data Source



Question:

I am going to use Address Book as my app's data source for use to add new contact or select a contact. The contact is mainly for company or organization, but it can be a person.

For adding a new contact, I would like to show a list of contacts, like people pick control:

alt text http://developer.apple.com/iphone/library/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Art/people_picker.jpg

However, I cannot figure out to change Cancel to Add, and Groups as Cancel. It looks like that there is no way I can set this controller' navigation bar to Add. Basically, I would like to display a list of contacts to choose as my add data source, and to provide Add function in the same view if user wants to add new one to the contact first and as data source.

Apple's Address Book Programming Guideline does provide one ABNewPersonViewController to add a new contact. Is there any way to add this to all contacts picker as its navigation tree? Does any one see similar example codes in Apple's example list(just too many to find out)?

Another related issue is that when the people picker controller is shown, it appears with animation from bottom up. Is there any way to control its animation from left just like navigation drill-down animation?


Solution:1

My recommendation: use a ABPeoplePickerNavigationController and add a toolbar to the bottom that has an Add button. The Add button would open a ABNewPersonViewController.


Solution:2

To do what you’re trying to do you’ll need to create your own controller which populates a table’s cells using the AB API. You can push your controller onto your existing navigation controller to get the animation you want, and use the ABNewPersonViewController to add new entries.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »