Zizoo Zizoo - 1 year ago 76
Swift Question

Why top Navigation Bar disappear when do some action on the view using Swift?

I have

which has one button to navigate to
every thing works good I can go back and press the button again and so on .But my problem when I do one action on the
which is
Share Contact
the top navigation bar will disappear and for sure I'll stuck in this view .. this is the code:

@IBAction func dothis(sender: AnyObject) {

let contact = CNMutableContact()
contact.givenName = "first Name"
contact.familyName = "Last Name"
contact.phoneNumbers = [CNLabeledValue(
label:"Work Phone",

let workEmail = CNLabeledValue(label:"Work Email", value:"ex@whatever.com")
contact.emailAddresses = [workEmail]

let controller = CNContactViewController (forContact: contact)
controller.contactStore = self.store
controller.allowsEditing = false

controller.displayedPropertyKeys =
[CNContactPhoneNumbersKey,CNContactEmailAddressesKey, CNContactPostalAddressesKey]

.pushViewController(controller, animated: true)


Do I need to implement something more for share contact and other actions on the


1- All actions on contact card work good like
Send Message
Share Contact
causing the problem.

2- When I compare the actions on my VC with the Contacts app I notice that the pop up options view of
Share Contact
comes over the navigation bar but in my app the options view come behind the navigation bar .

See Contacts app on the left and my app on the right :

Contacts App hereMy App

My Project file : Here it's small project

Answer Source

This is a bug according to this http://stackoverflow.com/a/33762209/3378099

Here is a non-elegant solution:

  1. Create an new class extending UINavigationController
  2. Assign it to your NavigationController in Storyboard
  3. Override function func setNavigationBarHidden(hidden: Bool, animated: Bool)

Reuploaded your project here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download