Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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. :)