Unwind Segue in Xcode 6.1.1 with storyboard

前端 未结 4 2090
广开言路
广开言路 2021-02-20 13:26

I have been reading that unwind segue\'s are bugged in Xcode 6. I am using Xcode 6.1.1 and I use swift.

I use the \"Back\" button that is put by the navigation controlle

4条回答
  •  情书的邮戳
    2021-02-20 14:08

    I want to provide a detailed answer:

    To perform an unwind segue, go to the view controller that you want to segue to and add the following function; (the name can change of course)

    @IBAction func unwindToMainMenu(segue: UIStoryboardSegue) {
    
    }
    

    Once you add this function, you will be able to see this unwind function from any view controller on your storyboard. Just right click on the exit icon on the top of any view controller.exit icon right click

    If you want to perform unwind with a button, then you can cntrl + drag from the button to exit icon and choose your unwindSegue function. Done!

    Unwind with Button

    If you want to perform unwind programmatically, then cntrl + drag from the viewController icon to the exit icon and choose the unwind function.

    enter image description here

    Afterwards, open the Document Outline and click on the unwind segue.

    enter image description here

    Go to Attributes Inspector inside Utilities and give an identifier to your unwind segue.

    enter image description here

    Lastly, call the performSegueWithIdentifier function like the following;

    self.performSegueWithIdentifier("goToMainMenu", sender: self)
    

    Hope that helps!

提交回复
热议问题