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 trialSteven Moss
447 PointsIBOutlets and IBAction : Quick reference...
When I need to add an additional button and IBAction to my ViewController do I need to always add an additional IBOutlet? Or does the one reference to the IBOutlet suffice for multiple buttons and actions?
1 Answer
kjvswift93
13,515 PointsNo, a UIButton element must be connected to it's own IBOutlet method and, assuming the button performs some action when pressed, an IBAction. That is, if you are not living in Xcode 2 days and are using Interface Builder. An outlet is essentially a pointer or reference connecting the button UI element in your view to it's code file. If you create more buttons, then they must be assigned a unique variable name and therefore it's own IBOutlet and action.