Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Playlist Browser with Swift Building the Master and Detail Views Displaying Playlist Information

Is there an alternate way to connect your UI elements without doing the ctrl drag?

Title says it all. Just wondering if there's an alternate way to connect code to UI elements.

Jorge Solana
Jorge Solana
6,064 Points

Pasan explained few videos ago:

  • You can connect elements by ctrl drag or just right clicking on your UI element and selecting the New Referencing Outlet or Action or whatever you need to connect.

Hope it helps.

1 Answer

Michael Foster
Michael Foster
7,801 Points

The two ways that I am aware of is to, ctrl drag or manually enter objective-c code that is automatically enter for you when using Ctrl drag into your header or implementation file.

Weird. Hopefully in the future there will be different ways to do it w/ Swift. I just find the drag thing to be clunky. Its kind of unity-like. I did find out you can write your code and then drag from code to UI, so that's at least better than dealing w/ a pop up box. :)