iPhone 地址簿搜索
我想在我的应用程序上创建内联地址簿搜索。基本上我有一个 UITextField,我想要它,以便当您开始输入文本时,它会从您的地址簿中显示搜索结果,并且可以在您单击它时自动完成您正在输入的内容。如果您查看短信或邮件应用程序,发送消息时在“收件人”字段中输入正是我想要的。
我浏览了Apple的地址簿编程指南,最接近的是ABPeoplePickerNavigationController。但这会带来一个新的视图控制器,这不是我想要的。所以我的问题是,是否有 iOS API 允许我使用此搜索功能?还是我必须自己写?
tl;dr 如何直接在文本字段中模仿 Apple 的地址簿搜索功能?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此演示项目包含用于从 UISearchBar 执行内联地址簿搜索的源代码。
This demo project includes source code to perform an inline address book search from a UISearchBar.
您需要使用 ABAddressBookCopyPeopleWithName API。
You'll need to use the ABAddressBookCopyPeopleWithName API.