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 Simple iPhone App with Swift Views and View Controllers View Controllers and IBAction

Nadaa Taiyab
Nadaa Taiyab
2,074 Points

How to fix mistake when connecting label to view controller

When I created by label and hooked it up to the view controller, I forgot to select "no arguments"before creating it. How do I go back and make that change?

Also, what if I accidentally selected outlet instead of action for a lablel? How would I go back and make that change?

Thanks you.

Nadaa

3 Answers

Rashii Henry
Rashii Henry
16,433 Points

This happens because in your .Storyboard file , Xcode does not automatically remove the last reference you made to that same outlet. (stupid Xcode!)

Simply go to your .Storyboard file -->Select the ViewController --> Click on Utilities Inspector --> Then click on the Connections Inspector --> Click on the x next to the associated Outlet.

Thank you! This had me stumped. First thing I did and my app exploded. Lol

Nadaa Taiyab
Nadaa Taiyab
2,074 Points

FYI I got this error:

self Fun_Facts.ViewController 0x00007fe4e1722740 0x00007fe4e1722740

It occurred after I added an IBOutlet, then deleted the code in the View Controller and then added it again. Please explain? Is this a bug in xcode?

Nadaa Taiyab
Nadaa Taiyab
2,074 Points

Thank you Rashii! In my version of XCode I could not find those inspectors. However, when I right clicked the View Controller at the top it showed the outlets and I could x it out.

Rashii Henry
Rashii Henry
16,433 Points

No problem, What version are you running?

just keep learning as much as you can. You're in a great place!