1

From the iphone system APP “Contacts”, in the “All Contacts” GUI and click “Add”, it will segue to “New Contact” GUI. Then from the “New Contact” GUI and add “new” item then click “Done”, it will seuge to the contact detail GUI(screenshot image 3). The issue is that: I used “Show(push)” to segue to image 3 from “Done” button, but the NavagationItem in the left corner displayed as “ back to New Contact “ rather than “back to All Contact”.

I attached the screenshot to describe the issue as bleow: screenshot

I tried two ways: way 1: pop the vc which matches the image2. The isssue is that New Record page will jump to image1 first, then jump to image3.

if let nav = self.parentViewController as? UINavigationController {
    if let vc0 = nav.childViewControllers.last as? AddRecordTableViewController {
        nav.popViewControllerAnimated(true)
     }
  } 
performSegueWithIdentifier(Constants.SegueAddRecordVCToViewRecordVC, sender: nil)

way 2: used the removeFromParentViewController to discard the vc matches image2. The issue is that the Navagation bar button in the left corner still displayed as “

if let nav = self.parentViewController as? UINavigationController {
    if let vc0 = nav.childViewControllers.last as? AddRecordTableViewController {
        vc0.removeFromParentViewController()
    }
} 
performSegueWithIdentifier(Constants.SegueAddRecordVCToViewRecordVC, sender: nil)
Vasil Nunev
  • 450
  • 1
  • 4
  • 16

1 Answers1

0

Why dont you try using self.dismissViewControllerAnimated(true, completion: {}); when "Done" is pressed.

Vasil Nunev
  • 450
  • 1
  • 4
  • 16
  • by using this, the "New contact" page will disappear and segue to the show detail contact information page, but the Navigation item displayed incorrectly, it showed as " – jasminesmell Mar 26 '16 at 06:07
  • I attached a screenshot in which to show the segue relationships – jasminesmell Mar 26 '16 at 06:26
  • ok i think i see your problem. why dont you give a segue to the button " – Vasil Nunev Mar 26 '16 at 23:14
  • if you are with navigation controller i suggest you to change that to a simple view controller and do the above instruction should fix your problem – Vasil Nunev Mar 26 '16 at 23:19
  • I tried it myself with simple view controllers and navigating around with segues it worked for me. I will recommend you doing the same and getting rid of the navigation controller in this situation – Vasil Nunev Mar 27 '16 at 01:42
  • I'm aftraid if I discard the navigation controller, the nagivation item will gone as well. can u pls send the code? – jasminesmell Mar 28 '16 at 07:17
  • Thanks Vasil, is it ok I send you my code by mail so that you can see the problem and help me for correcting? – jasminesmell Mar 29 '16 at 06:58