简体   繁体   English

iPhone地址簿搜​​索

[英]iPhone Address Book Search

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. 基本上我有一个UITextField,我想要它,这样当你开始输入文本时,它会显示你的地址簿中的搜索结果,并且可以自动完成你点击它时输入的内容。 If you look in the SMS or Mail application, typing in the "To" field when sending a message is exactly what I want. 如果您查看SMS或邮件应用程序,在发送邮件时键入“收件人”字段正是我想要的。

I've looked through Apple's Address Book Programming Guide and the closest thing it has is ABPeoplePickerNavigationController. 我查看了Apple的地址簿编程指南,最接近的是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? 所以我的问题是,是否有iOS API允许我使用此搜索功能? 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? tl; dr如何直接在文本字段中模仿Apple的地址簿搜索功能?

演示项目包括从UISearchBar执行内联地址簿搜索的源代码。

您需要使用ABAddressBookCopyPeopleWithName API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM