开发者

Creating an Address Book UI Similar to iPad's 'Contacts' App

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!


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 the ABPersonViewController. An option would be to use an ABUnknownPersonViewController for any time that there is no matching recordID in the address book for your person.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜