Is there a way to set an exit link in Interface Builder without Ctrl-Drag

So I'm just trying to create a very simple application for demo purposes here:

  • Created a one-view app using storyboards
  • Added UIView to storyboard
  • The following code is added to the following header of my controller:

    @property (weak, nonatomic) IBOutlet UIView *myView; 

Now I understand that I can associate a UIView with a controller:

  • arrange my code so that the header file is next to the storyboard
  • holding the Ctrl key and dragging it to a property in the header file

My question is this: can I do without Ctrl-drag? And if so, how?

More specifically, it annoys the need to simultaneously place both my header file and the storyboard on the screen, and there seems to be a way to make this connection without it.

I also understand that I can manually place the view by creating it inside my controller's viewDidLoad function, but I would really like to use the interface constructor to simplify / visualize things.

Edit: Is the answer to my question affected, am I using storyboards or xib / nib files? (I would switch to the one where he works)

+4
source share
2 answers

In addition to Dima’s answer, you can also use the connection inspector in the Utilities panel

Connection inspector

+4
source

you can right-click an element and drag the "exit link" element into the "File Owner" view in the interface builder. There it will provide you with a list of all available IBOutlets (corresponding to the type of object).

+5
source

All Articles