拖动到视图控制器的出口不起作用 [英] Dragging onto the exit of the viewcontroller not working

查看:18
本文介绍了拖动到视图控制器的出口不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处找这个问题.我知道放松场景是如何运作的.我在 A VC 中实现了以下代码

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";
}

但是当我转到我的 B VC(我想从哪个 VC 返回到 A VC)并按 ctrl 将按钮拖到底部的出口上时,它不允许我这样做.并且退出选项中没有弹出任何功能.还有其他人遇到过这个问题或可以提供帮助吗?

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?

推荐答案

要设置放松转场,您应该

To set up an unwind segue, you should

  1. 使用标准模式设置两个场景或在它们之间推送转场:

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

将这两个场景的自定义类定义为各自的视图控制器.

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

为视图控制器 A 实现 .m 中的操作:

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

- (IBAction)unwindToA:(UIStoryboardSegue *)segue
{
    //returning to A
}

  • 然后您可以通过control-从某个控件向下拖动(或右键单击拖动)到场景下方栏中的出口出口,在B中创建一个segue B:

  • 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:

    如果以上所有内容都配置正确,您现在将在弹出窗口中看到您的 unwind segue:

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

    这篇关于拖动到视图控制器的出口不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆