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
Tom Coomer
1,331 PointsDismiss keyboard on scroll view
I have the code to dismiss the keyboard by clicking on the background(view) but how would I change it so it is dismissed when you tap on an image view?
Tom Coomer
1,331 PointsI have an image view, inside a view, inside a scroll view.
1 Answer
Stone Preston
42,016 Pointsok. have you tried calling [self.view endEditing:YES] in your touchesEnded method of the image view?
Tom Coomer
1,331 PointsWhere do I add this?
Stone Preston
42,016 Pointsin the touches ended method of your image ViewController. You will have to add the touchesEnded method to your implementation file. Have you done the crystal ball project? It covers touch events in detail so you may want to do that first. Its a quick project that takes about 2 hours.
Stone Preston
42,016 PointsStone Preston
42,016 Pointsis that image view a child of the view?