The keyboard can be dismissed in multiple ways, one of which is through delegation. Delegation is how many iOS objects handle events—the object that triggers the event notifies the delegate that the event occurred, and the delegate handles the event. Learn more in this video.
- [Instructor] So we can resign keyboard…by calling resign first responder on the text field…which happens when we hit the say hello button.…We hit that button.…resign first responder is called.…Keyboard is dismissed.…But what if you wanted to dismiss the keyboard…when the user clicks somewhere off of the text field…or when they hit the return button?…You may have seen some apps have this key say done…instead of return.…You hit that button and it closes the keyboard as well.…So let's look at both of those scenarios in this movie.…
So let's head back over to Xcode and in here,…what I'm going to do is handle clicking outside…of the text field and that's going to dismiss…the keyboard as well.…To do that, we're going to handle an event…that's already built-in to a view controller subclass.…So we're working in this class right here called…ViewController and it's a subclass of UIViewController.…So that means it inherits certain functionality…that UIViewController has.…
Part of that functionality is responding to user input…
- Installing and using Xcode
- Working with storyboards
- Working with UI objects and events
- Resizing objects and layouts dynamically
- Coding UI objects such as buttons
- Loading and displaying data in table views
- Testing your iOS app
Skill Level Beginner
1. Xcode Fundamentals
2. Core Skills
3. Responsive UI Design
4. Coding UI Objects
5. Table Views
6. App Flow and Testing
Next steps1m 8s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.