iPhone Address Book Search - iphone

I want to create an inline address book search on my application. Basically I have a UITextField and I want it so that when you start typing text in, it will bring up search results from your Address Book, and can auto-complete what you're typing when you click it. If you look in the SMS or Mail application, typing in the "To" field when sending a message is exactly what I want.
I've looked through Apple's Address Book Programming Guide and the closest thing it has is ABPeoplePickerNavigationController. But this brings up a new view controller, which is not what I want. So my question is, is there an iOS API that allows me to use this search functionality? Or do I have to write my own?
tl;dr How do I mimic Apple's Address Book search function directly in a text field?

This demo project includes source code to perform an inline address book search from a UISearchBar.

You'll need to use the ABAddressBookCopyPeopleWithName API.

Related

Name input like SMS or Facebook app

I'm trying to find a library that can handle autocompletion with tokened (grouped) texts.
There are some very nice libraries out there for autocompletion such as:
https://github.com/EddyBorja/MLPAutoCompleteTextField
https://github.com/hoteltonight/HTAutocompleteTextField
https://github.com/TarasRoshko/TRAutocompleteView
The problem here is, I want to make the selection look like names tagging at SMS or Facebook app. So when the user tries to delete, he should delete all the text.
There are good jQuery implementations, one of them is this:
http://loopj.com/jquery-tokeninput/
I couldn't find any for iOS, perhaps the keywords are very generic, thus Google does not show any related results. Is there any library for this or can you provide any code examples?
What you're trying to achieve can't be done using the public SDK.
However, there exist some nice third party solutions.
I found this question, Is there an iPhone equivalent to the NSTokenField control?, which includes links to controls you could use.

Implementing a To-field as in mail.app

Is there a way to get the To-field, as it is implemented in mail.app, into my app easily? If not, how would you go about creating such an advanced component that has manual text entry, "packaging" of entered addresses in "blue boxes", line wrapping and a '+' button to access the address book?
(I already have the code necessary to pick out contacts/e-mail addresses, I'm only asking about the To-field.)
Apparently the TTMessageController in Three20 is what you're looking for, according to this question: How to create a To field like the one in Mail or Facebook app?

How to create a To field like the one in Mail or Facebook app?

Does anyone know how to create a 'To field' like the one in Mail or Facebook app?
When an address is added from the A-Z list, a blue component that represents the address will be added to the text field. Is there a class provided for this functionality, or do we have to implement by ourselves?
There's no built-in framework. You'll either need to implement it yourself or use one of the open source components, such as Three20 (which includes the one used in the Facebook app).
In Three20's author's blog I found these few lines:
Message composer
TTMessageController emulates the
message composer in Apple's Mail app.
You can customize it to send any kind
of message you want. Include your own
set of message fields, or use the
standard "To:" and "Subject:".
Recipient names can be autocompleted
from a data source that you provide.
Maybe you should take a look at its source code at github.

How can I change the look of ABPeoplePickerNavigationController so that i can see phone number type (home,mobile etc)

I am using ABPeoplePickerNavigationController in my app ,but client wants to see label of phone number infront of name say
"Name number type"
Ali mobile
Ali home
is there a way to customize ABPeoplePickerNavigationController to fulfill this requirement?
thanks
If you want to customize the address book according to your requirements, I suggest you should not use ABPeoplePickerNavigationController. Instead of that make the use of Address Book object, retrieve data from your address book and display those data in your custom ViewController.In this way you will be able to customize your View in whichever way you want.
Secondly you cannot modify the APIs and frameworks provided by Apple.

iPhone Objective-C: Select from table and diplay selected ones in the style of the "To:" part of iPhone's SMS, email, etc

I want to be able to select items from a table and display them like how the iPhone displays the list of recipients for SMS, email, etc. It would be great if you could lead me to any resources and/or direction for this kind of thing. (I wasn't really sure how to Google this kind of thing too.)
Thanks in advance!
If you mean the interface with each email address in a little bubble, and they get highlighted if you hit backspace and deleted if you hit backspace again, it's kind of complicated to reproduce (I've done it). This is partly because (at least prior to iOS4) the way you interact with the keyboard is a bit limited. You need to have a hidden space character at the beginning of your UITextField to even get a call when the user hits backspace when there are no other characters left.
As for creating the table that shows the addresses from the user's address book, use a standard UITableView and do yourself a favor and use Erica Sadun's address book utilities to get the data from the address book.
There is something very similar in the Three20 framework, so I'd suggest you have a look at that.