简体   繁体   中英

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:

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."

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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