创建类似于 iPad 的“联系人”的地址簿 UI应用程序
我正在为 iPad 编写一个应用程序,允许用户从地址簿中选择联系人并输入新联系人 - 其中一些新联系人可能会保存回地址簿,有些可能只驻留在我的本地数据库中。我想做的是创建一个看起来类似于苹果联系人应用程序的界面。当我查看地址簿 UI API 时,看起来这个 UI 是专门为 iPhone 设计的。对我来说,看起来我有三个选择:1)允许地址簿导航控制器劫持全屏(并且我不确定如何将本地存储的联系人添加到列表中)2)在弹出窗口 3) 直接访问地址簿并从头开始构建我自己的 UI。这是正确的吗?创建联系人列表很容易,但“新联系人”用户界面会很麻烦。我不能在子视图中至少使用 ABNewPersonViewController 吗?
感谢您提供的任何帮助!
I am writing an app for the iPad that will allow users to select contacts from the address book and enter new contacts - some of these new contacts might get saved back to the address book, some may only reside in my local database. What I would like to do is create an interface that looks similar to Apple's Contacts app. When I look at the Address Book UI API, it looks like this UI was designed exclusively for the iPhone. To me, it looks like I have three options: 1) allow the address book nav controller hijack the full screen (and I am not sure how to get my locally stored contacts on to the list) 2) show the address book UI in a popover 3) access the address book directly and build my own UI from scratch. Is this correct? Creating a list of contacts is easy, but the "new contact" UI would be a hassle. Can I not use at least the ABNewPersonViewController in a subview somehow?
Thanks for any help you can provide!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Apple 会要求您使用他们的 ABAddressBook。 Apple 文档(查看地址簿编程指南)中规定的首选方法是通过使用记录 ID 来维护与真实地址簿的链接,该记录ID 可以用于在本地与您一起工作且也在真实地址簿中的任何人。 Apple 建议您将 recordID、名字、姓氏和复合名称存储在本地数据库中。此外,您还可以存储特定于您的应用程序的任何数据。
您可以使用 peoplePicker 的委托方法来保留 person 对象的句柄。
当您使用 recordID 时,有一个方法
ABAddressBookGetPersonWithRecordID
,如果真实地址簿中存在人员记录,该方法将返回人员记录。然后您可以使用ABPersonViewController
编辑它们。如果您的地址簿中没有匹配的 recordID,则可以选择使用ABUnknownPersonViewController
。Apple will want you to use their ABAddressBook. The preferred method that is stated in the Apple Docs (check the Address Book Programming Guide) is to maintain a link to the real address book by using a recordID for any people who you are working with locally who are also in the real address book. Apple suggests you store the recordID, first Name, last name and composite name in your local database. Additionally you would store any data that is specific to your app.
You can use the delegate methods of the peoplePicker to keep handles on the person objects.
When you are using the recordID there is a method
ABAddressBookGetPersonWithRecordID
that will return a person record if one exists in the real address book. Then you can edit them with theABPersonViewController
. An option would be to use anABUnknownPersonViewController
for any time that there is no matching recordID in the address book for your person.