Unable to drag @IBOutlet from fast file to ViewController storyboard in Xcode 7.2

I am using Xcode 7.2

I can use Ctrl + drag for quick file to create @IBOutlet
enter image description here

But I can not drag @IBOutlet to the fast file in the storyboard. Here I do not use another key, just drag and drop.
enter image description here In fact, when I move the mouse to the place in front of @IBOutlet, nothing happened, and when I try to drag it, a breakpoint is added.

1. I'm sure I'm using the correct class name
2.My project is not in a strange way or name

+5
source share
2 answers

do not use Control, just drag from the circle icons. You can see in the picture below. Circle icons in red box

enter image description here

+2
source

Modified behavior

The behavior has changed in newer versions of Xcode (I'm not sure, but maybe it was with 7+.). Older versions of the product may still work with the gutter label.

Now you need to either open the connection inspector or right-click on the view controller in the document structure. After opening, drag from a specific IBOutlet to your UIView subclass (UIButton, UITextField, etc.)

Connection Inspector

inspector

Controller view

controller

Official guide

Find your local help at: Builder Connections Help Interface: Create an output connection. You will find that these are the only methods that now work. The gutter label does not work.

apple-help

Nota Bene:

You can confirm this behavior and other changes in the Xcode shortcuts by selecting the following Help> Xcode Overview and looking at Part V: creating a user interface, section “Connecting Objects in Code”.

+2
source

Source: https://habr.com/ru/post/1240671/


All Articles