Yohann will take a look at a method that is only available on TVOS: the new Focused Environment method, which allows the developer to get a handle of the previous view that lost focus and also get a handle of the next focused view and be able to perform custom visual feedback and trigger custom code snippets.
- [Voiceover] Sometimes, when a view gets focused on,…or when a view loses focus,…the app should trigger some code logic.…Apple made it easy to do so,…by giving developers a function that can be overridden.…The name of the method is didUpdateFocusInContext.…This function allows the app to get ahold…of what's going to be the next focus view,…and also get ahold of the view that is losing focus,…also called the previous view.…
I want to reference the previous…and next views for many reasons.…I can trigger a custom piece of code.…I can easily modify any property of a view,…like the display text, view size, or color.…I can even add an animation.…The view can be of any class type.…It can be a regular view, a text field,…a label, a button, or even a custom view.…Back in Xcode, I want to implement this…in the Explore California TV app.…
I want to see which view is getting the focus,…and which view is losing focus in the app's first (mumbles).…I'll start in the FirstViewController.m code file,…and at the end of it, I'm going to add a method…
- Setting up Apple TV for Xcode
- Developing for tvOS
- Adding a new target to the project
- Running targets in the Simulator
- Working with the tvOS UIKit
- Adding images and sounds to the app
- Building the user interfaces
- Adding and connecting modal views
- Connecting the tab screens to the code
- Adding a tvOS app with iTunes Connect
- Publishing tvOS apps
- Adding advertisements to tvOS apps
Skill Level Intermediate
1. Getting Started
2. tvOS UIKit
Work with the storyboard1m 25s
3. Porting an App
4. iTunes Connect
5. App Publishing
6. Extra Features
- 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.