Skip to content

Instantly share code, notes, and snippets.

@NSURLSession0
Created June 6, 2016 12:56
Show Gist options
  • Save NSURLSession0/6aaf79fb4c2100471fb8744a9b974b3c to your computer and use it in GitHub Desktop.
Save NSURLSession0/6aaf79fb4c2100471fb8744a9b974b3c to your computer and use it in GitHub Desktop.
tvOS detect tabbar show/hide in Swift
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
let prevFocusViewClassName = NSStringFromClass(context.previouslyFocusedView!.classForCoder)
let nextFocusedView = NSStringFromClass(context.nextFocusedView!.classForCoder)
let barButtonName = "UITabBarButton"
if prevFocusViewClassName == barButtonName && nextFocusedView != barButtonName {
// Tabbar disappeared
} else if prevFocusViewClassName != barButtonName && nextFocusedView == barButtonName {
// Tabbar appeared
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment