Unwind Segue in Xcode 6.1.1 with storyboard

前端 未结 4 2169
广开言路
广开言路 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:01

    Got it working on Xcode 6.2. My case is ViewController A presenting B modally. Unwind setup steps below:

    1. In A, write an IBAction

      -(IBAction)unwindFromB:(UIStoryboardSegue *) unwindSegue 
      {
        ViewControllerB *vc = [unwindSegue sourceViewController];
        // get whatever data you want to pass back from B
      }
      
    2. In storyboard, find B and right-click the 'Exit' button at the top, then the 'Presenting Segue' menu will list unwindFromB you've just created in A

    3. Click the little '+' sign to the right and link it back to B, select 'manual'

    4. Don't forget to set identifier of the unwind segue if you need to call it programmatically.

提交回复
热议问题