Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
384 views
in Technique[技术] by (71.8m points)

ios - Dragging onto the exit of the viewcontroller not working

I have looked for this problem everywhere. I know how the unwind scene works. I have implemented the following code in the A VC

-(IBAction)returned:(UIStoryboardSegue *)segue {
try.text = @"Returned from Scene 1";
}

But when I go to my B VC(Which is the VC I want to go back to A VC from) and ctrl drag a button onto the exit at the bottom it will not allow me to. And no function pops up in the exits option. Anyone else had this issue or can help?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To set up an unwind segue, you should

  1. Set up your two scenes with the standard modal or push segue between them:

    enter image description here

  2. Define the custom classes for those two scenes to be your respective view controllers.

  3. Implement the action in the .m for view controller A:

    - (IBAction)unwindToA:(UIStoryboardSegue *)segue
    {
        //returning to A
    }
    
  4. Then you can create a segue in B by control-dragging (or right-click-dragging) from some control down to the exit outlet in the bar below scene B:

    enter image description here

  5. And if everything above is configured correctly, you will now see your unwind segue listed in a popover:

    enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...