I have a general question concerning the navigation between views.
I have a view controller 1 embeded in a navigation controller. In the nav bar, I have a button to do add data, when pushed, it goes to view controller 2 through segue Show (in Storyboard). In view controller 2, I return to view controller 1 after collecting data when I click the button save in nav bar on the right. I collect data with:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {...}
I would prefer instead of a back button to have a cancel button in the view controller 2 to return to view controller 1.
I feel something is wrong in my design but I dont know what.
In fact I am looking for something very similar to app clock.
Do you have any idea?
Edit: Here is the story board. you will notice the loop beween the two controller. how to do when I click save to not have a back button automatically on the first controller?
You just have to select your UIBarButtonItem, click at show Attributes Inspector, click at Identifier and select "Cancel" from the drop-down menu.
@IBAction func cancelDownload(sender: AnyObject) {
dismissViewControllerAnimated(true, completion: nil)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With