Andy Johnson
Andy Johnson

Reputation: 8149

How to create an outlet in XCode 5

I'm new to iOS development and am working through some tutorials. I'm using XCode 5 but the tutorials are a re for XCode 4, and I'm having problems creating outlets.

I have a UIViewController containing two buttons. I click on the Assistant Editor icon to view the .h file next to the design surface. Then I ctrl-drag one of the buttons onto the .h file. A popup appears and the tutorial says that I should be able to select the connection as either Outlet or Action, but the connection chooser is greyed-out and I can only create an Action.

So, how do I create an Outlet?

Upvotes: 0

Views: 143

Answers (2)

Andy Johnson
Andy Johnson

Reputation: 8149

Problem solved. I was trying to ctrl-drag into the .m file, not the .h file. When I selected the .h file I was able to create the outlet. Newbie error!

Upvotes: 1

Choppin Broccoli
Choppin Broccoli

Reputation: 3066

That should work. If the File Owner of the .xib file the same as the .h file you are control-dragging to, then it should automatically be an Outlet in the popup.

Upvotes: 1

Related Questions