Dismissing the keyboard is a common task in iOS, but some keyboards don't have a dismiss button built in. In this movie, learn how delegation works in iOS and how to use delegation to dismiss the keyboard from the screen. Learn how to tell an object to stop being a first responder in multiple ways in the iOS SDK in Xcode 7.
- [Voiceover] Continuing our example here…about working with labels and text fields and buttons…and outlets and first responders,…what if we wanted to hide the keyboard…when the user pressed the Return key?…To do that, we need to use something called delegation.…A delegate is an object that is…connected to another object…and that can receive its events.…For example, we can set our View Controller object…as a delegate of our text field…so that when other events happen,…like when the text field finished editing or something,…that data then can be sent to and handled by…our View Controller class.…
Let's look at adding a delegate here.…What we want to do is implement the delegate protocol.…In other words, we need to say…that our View Controller can possibly be…a delegate for a UI text field.…To do that, we declare that right after…we declare the super class.…After UIViewController, on line 11,…I'm going to type a comma and then a space…and then I'm going to type UITextFieldDelegate.…
Now this is saying this can handle…
Interested in developing for Apple Watch or Apple TV? Get a sneak peek in Chapter 9. The course wraps up with a look at the submission process for the App Store.
- Installing Xcode and the iOS SDK
- Creating a simple iOS app
- Creating a basic interaction with a button
- Choosing an object as a first responder
- Creating a user interface with Interface Builder and Auto Layout
- Working with sliders and progress bars
- Creating views to show images and web pages
- Developing responsive layouts with size classes
- Understanding the iOS architecture
- Loading data in table views
- Transitioning between views
- Developing for the iPad, Apple Watch, and Apple TV
- Submitting apps to the App Store
Skill Level Beginner
Building a Note-Taking App for iOS 9 with Swiftwith Todd Perkins1h 20m Intermediate
1. Prepare to Develop an iOS App
2. Core Skills
3. Basic iOS UI
4. More UI Objects
5. Size Classes
6. iOS Application Architecture
7. Table Views
8. Multiple-View Applications
9. iPad, Watch, and Apple TV Development
10. Finish and Submit to the App Store
Next steps2m 10s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.