Daily Archives: August 25, 2015

Ctrl-drag to Create Outlets in Custom Views

If anyone can tell me why Xcode (I’m using Xcode 7 beta 5) works this way, I’d greatly appreciate. I have created custom table view cells in the past and I’ve always control-dragged from my storyboard into the custom class to create the outlets. So, when I went to create outlets for a custom (ui)view I’m working on, I was stumped when I couldn’t ctrl-drag into the .h or .m file to create them (outlets or actions).

[Yes, I have all the relevant custom classes specified in the Identity inspector.]

The workaround is to type in the outlet/action code by hand. Once you have entered in your custom class file, you can connect the outlets/actions by dragging from the little dot (do these things have a special name?) Xcode puts in the line number gutter to the relevant UI element. What a pain in the ass.