Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Allow your users to create new contacts with the ABNewPersonViewController class. This view controller offers an editing screen that simplifies the interactive creation of a new Address Book entry. After allocating and initializing the view controller, start by creating a new contact and assigning it to the displayedPerson property. If you want, you can prefill the contact’s record with properties first.
Next, assign the newPersonViewDelegate, making sure to declare the ABNew-PersonViewControllerDelegate protocol in the delegate class. Delegates receive one new callback: newPersonViewController:didCompleteWithNewPerson:. This callback is sent for both selection and cancel events. Check the person parameter to determine which case applies, as shown in Recipe 17-5. If the person is nil, the user tapped Cancel, and the new contact should not be added to the Address Book. If the user taps Done after editing the new contact, add the contact data to the Address Book and save it.