From the course: Building a Note-Taking App for iOS 11 with Swift

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Show and hide the software keyboard

Show and hide the software keyboard

From the course: Building a Note-Taking App for iOS 11 with Swift

Start my 1-month free trial

Show and hide the software keyboard

- [Instructor] So I mentioned earlier that we can show the software keyboard with Command + K or Hardware, Keyboard, Toggle Software Keyboard in the simulator application. Without the software keyboard showing, if you select an item and you click inside of the text field, you don't get that software keyboard. If you press Command + K, though, you get it to show up. So if I go back to my main notes, I select a note again, the keyboard doesn't show up until I select my note. So what if we wanted that text view to be selected automatically and the keyboard to pop up right away so the user can just start typing text into the text view? Let's look at how that works. I'll stop the app and return to Xcode in DetailViewController.swift. So what we're going to do is handle the method in here with viewWillAppear. So every time the view's about to appear, we're going to select that text view and make it show the keyboard. So let's handle that right below viewDidLoad. So it's viewWillAppear. And…

Contents