1

In writing an app for iPhone/iPad, I like to restrict the fields within the Address Book that can be edited.

As an example, each contact has a name, phone number(s), email(s), and an address. I'd like to allow editing of just the phone number(s) and email(s) fields and to simply display the name and address without the option of changing them since the name and address fields have been created elsewhere in the app.

Is it possible to be this selective when invoking the Address Book feature that allows editing of a contact record? It doesn't seem so since the choices for editing seem to be just YES or NO.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Michael Young
  • 414
  • 1
  • 7
  • 16

1 Answers1

0

You have a few options:

  • Implement your own editor instead of using ABPersonViewController. This is the best way to go since you can display whatever you want and restrict editing to whichever properties you want. But it will take the most effort to complete.

  • Create a separate instance of ABRecordRef with only the properties that may be edited, and copy the edited values back to the original ABRecordRef after editing. This is a poor option because only those properties which are editable are going to be visible.

  • Create an exact copy of the ABPersonRef and assign that to the ABPersonViewController. When editing is done, only copy the desired properties back to the original ABPersonRef. This is better than the second option because all properties are displayed, but it will confuse the user if they are allowed to perform an edit that is not saved.

bneely
  • 9,083
  • 4
  • 38
  • 46
  • I'd probably prefer the first option too, but I don't know quite how to create an exact replica of the ABPersonViewController.xib. Option two might work if I could just put the name and address on the .xib as labels. Too bad we can't get at the .xib but maybe you or others might have a workaround of this sort. – Michael Young Sep 16 '13 at 23:27
  • I'd say that if you're not providing the same exact functionality, you should not replicate the look of ABPersonViewController. That would confuse users who have an expectation of how that UI works from using it in other applications. And it could cause Apple to reject your app if you want to publish it in the App Store. I think you should implement a new, unique UI for what you want to accomplish. – bneely Sep 16 '13 at 23:35
  • Good points. Wouldn't want a rejection after all the hard work. Got to think about this more. – Michael Young Sep 16 '13 at 23:57