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 trialAdam Berkowitz
2,673 PointsTrouble with UIWebView and IBOutlet
I'm working through the blog reader project and have run into a problem. For some reason when I control/click on UIWebView in mainStoryboard.storyboard and drag the blue line to webController.h, nothing happens. No IBOutlet is created, no dialog is created, nothing. Does anyone know why this might be happening?
4 Answers
Enara L. Otaegi
13,107 PointsHave you set your custom class on the identity inspector?
Patrick Donahue
9,523 PointsThat is a good answer. I have been there more than once!
Enara L. Otaegi
13,107 PointsYes, me too :D
Adam Berkowitz
2,673 PointsI must have missed that step. I'll go back and check how to do it. Right now, in the identity inspector (under the custom class heading), it just says "Class" and the dropdown says "UIWebView".
Enara L. Otaegi
13,107 PointsSometimes the dropdown doesn't show your classes, just type webController if that is your class name.
Adam Berkowitz
2,673 PointsSomething's still not right. When I type in the name of the custom class "webViewController" I just get an error sound/beep and I still can't create the IBOutlet. I suppose I will try adding it programmatically and see if that works.
Enara L. Otaegi
13,107 PointsThat's weird. Usually when I get that beep error sound it's because the class doesn't exist or doesn't match the object I have in the storyboard.
Adam Berkowitz
2,673 PointsOk - I think I solved the problem. It seems I was selecting/renaming the UIView instead of UIViewController. When I went into the mainStoryboard hierarchy and selected UIViewController manually (instead of clicking in the storyboard) I was able to rename it to WebViewController. Then I could ctrl/drag the blue line into WebViewController.h normally.
Thank you both so much for the help!
Patrick Donahue
9,523 PointsGood job! Glad you were able to figure it out!
Enara L. Otaegi
13,107 PointsGood job! Happy to see you solved it :D
Patrick Donahue
9,523 Points"... exactly like Amit does in the video. I my UIViewController to the same name. "
You created the same file name? That would be an issue.
Enara L. Otaegi
13,107 PointsCan you post the code from your WebViewController.h?
Adam Berkowitz
2,673 PointsAdam Berkowitz
2,673 PointsI went back one video to try to replicate exactly what's happening and now I have a different problem! I created the custom class "WebViewController" exactly like Amit does in the video. I my UIViewController to the same name. But now, when I try to drag UIWebView onto it, XCode rejects what I'm trying to do... Clearly something is wrong, but I have no idea what.