2

I want to create a custom UINavigationBar for CNContactViewController in order to select single or multiple contact. The default UINavigationBar consists of Cancel,Done and Group button which makes it look quite messy. Is there a workaround to customize the UINavigationBar of the CNContactViewController? Can Anyone answer this asap? This is how my page looks right now

Isha Balla
  • 733
  • 2
  • 9
  • 25

1 Answers1

2

Your screenshot is CNContactPickerViewController, not CNContactViewController. But the answer is the same for both.

The Contacts view controllers each have a very specific purpose: choosing a contact, creating a contact, etc. They each have a navigation bar suited to that purpose — the contact pocket needs that Done button so the user can select a contact and return control to your app. And they're hosted out of process so that malicious apps can't dig inside to harvest contact info they're not supposed to.

Since it's out of process, you can't customize the navigation bar directly. Contacts would need to define an API for that, and it doesn't. Perhaps you should file a feature request for that? Then again, I'm not sure what the use case for removing any of those buttons is...

rickster
  • 124,678
  • 26
  • 272
  • 326
  • Is there any other way to achieve what I am looking for? @rickster – Isha Balla May 11 '16 at 09:29
  • 1
    You could build your own contact picker and design the UI any way you want. But then the user would have to grant your app permission to read all of his/her contacts so you could display them. (Since `CNContactPickerViewController` provides only one contact, explicitly through user action, your app doesn't need blanket Contacts permission to use it.) – rickster May 11 '16 at 13:49