Chapter 1 : Page 18 IBAction created not showing on Main.storyboard

#1

I created the two IBAction functions as requested and when I try and control drag to the buttons as we did for the labels nothing pops up in the black square but “outlets views” option. I do not see the to IBActions i created to select.

#2

So I used the assistant viewer to create the IBAction and specified touch up inside based on the images in the following pages. Is this due to XCode versions or am I seeing a bug?

#3

Did you follow the instructions in the book carefully?

The following tutorial explains how to connect UI control objects to outlets and actions in your code.

Start Developing iOS Apps - https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/index.html

#4

I followed the steps 100%. I tried it multiple times with doing all the steps over.

If you (for example) add @IBAction func showNextQuestion(send: AnyObject) to ViewControler.swift, you can not go to the storyboard and control click drag to add it to the button. There seems to be a step missing. I had to control click from the button to the advanced view and add it that way.

Doing some testing, it looks like instead of control click drag from storyboard (view controller) to the button, you need to control click the button, select touch inside, and choose the @IBAction now.

@IBOutlet works with a control-click and dragging it to the object in the storyboard such as a Label.

Nathan

#5

Is the book you have compatible with the version of the Xcode you have?

Make sure that it is.

#6

Using XCode 7.X could be the point release is higher than the book. I didn’t download the beta 8.X since the book is for 7. Either way I found a work around so maybe need added to 6th Edition.

Appreciate the quick responses.
Nathan

#7

You are dragging in the wrong direction:

  1. To connect a variable marked with @IBOutlet, you drag from the ViewController to the item in the storyboard.

  2. To connect a function marked with @IBAction, you drag from the item in the storyboard to the ViewController.

#8

Thats it! Thank you for this clarification. Much appreciated.

Nathan