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

和自甴很熟 提交于 2019-12-08 17:28:08

问题


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:

I cannot Control-drag from a UIBarButton to the Exit item in the scene dock. 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.

To unwind back to 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.

To link buttons to the unwindToList: action

  • In the project navigator, select Main.storyboard.
  • On the canvas, Control-drag from the Cancel button to the Exit item in the add-to-do-item scene dock.
  • [...]
  • A menu appears in the location where the drag ended. Choose unwindToList: from the shortcut menu. This is the action you just added to the XYZToDoListViewController.m file. This means that when the Cancel button is tapped, the segue will unwind and this method will be called."

回答1:


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. Once you do that, the popup should appear from the exit icon.




回答2:


Have you tried saving the XYZToDoListViewController.m after you wrote the unwindToList method?

I just added another unwind method and it only showed up in the exit menu after saving the view controller.



来源:https://stackoverflow.com/questions/19543324/storyboard-control-drag-from-a-bar-button-to-the-exit-item

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!