简体   繁体   English

故事板:按住 - 从条形按钮拖动到“退出”项

[英]Storyboard: Control-drag from a bar button to the Exit item

So I'm working on a new tutorial from Apple ( https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html ) and got to a point where I'm having a problem with the storyboard: 所以我正在研究Apple的新教程( https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html ),并且我遇到了一个问题。故事板:

I cannot Control-drag from a UIBarButton to the Exit item in the scene dock. 我无法控制 - 从UIBarButton拖动到场景底座中的Exit项目。 When I click on the Exit item the Attributes inspector says "Not Applicable". 当我单击“退出”项时,“属性”检查器显示“不适用”。

Here is an extract of the tutorial. 以下是本教程的摘录。 I am not able to post immages. 我无法发布影像。 For a better understanding of my problem you can see an image of the Control-drag to the Exit item at the bottom of the page. 为了更好地理解我的问题,您可以看到Control的图像 - 拖动到页面底部的Exit项目。

To unwind back to XYZToDoListViewController 放松回XYZToDoListViewController

[...] [...]

To create the unwind segue, link the Cancel and Done buttons to the unwindToList: action through the Exit icon in the dock of the source view controller, XYZAddToDoItemViewController. 要创建展开segue,请通过源视图控制器XYZAddToDoItemViewController的Dock中的Exit图标将Cancel和Done按钮链接到unwindToList:动作。

To link buttons to the unwindToList: action 将按钮链接到unwindToList:动作

  • In the project navigator, select Main.storyboard. 在项目导航器中,选择Main.storyboard。
  • On the canvas, Control-drag from the Cancel button to the Exit item in the add-to-do-item scene dock. 在画布上,按住Control键并从“取消”按钮拖动到“添加到项目”场景停靠栏中的“退出”项。
  • [...] [...]
  • A menu appears in the location where the drag ended. 拖动结束的位置会出现一个菜单。 Choose unwindToList: from the shortcut menu. 从快捷菜单中选择unwindToList :. This is the action you just added to the XYZToDoListViewController.m file. 这是您刚刚添加到XYZToDoListViewController.m文件的操作。 This means that when the Cancel button is tapped, the segue will unwind and this method will be called." 这意味着当点击取消按钮时,segue将展开并调用此方法。“

You can only do this if you have a method that knows how to handle these events. 如果您有一个知道如何处理这些事件的方法,则只能执行此操作。 This method has to have the following signature structure: 此方法必须具有以下签名结构:

- (IBAction)finishedDoingWhatever:(UIStoryboardSegue *)sender;

Note that it has to be an IBAction and that it takes the segue as an argument. 请注意,它必须是IBAction并且它将segue作为参数。 Once you do that, the popup should appear from the exit icon. 完成后,弹出窗口应显示在退出图标上。

Have you tried saving the XYZToDoListViewController.m after you wrote the unwindToList method? 您是否尝试在编写unwindToList方法后保存XYZToDoListViewController.m?

I just added another unwind method and it only showed up in the exit menu after saving the view controller. 我刚刚添加了另一个展开方法,它只在保存视图控制器后出现在退出菜单中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM