You can perform your action when one of the buttons becomes focused.
, , . enum .
enum FocusedButtonTag: Int {
case First
case Second
case Third
case Fourth
}
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
super.didUpdateFocusInContext(context, withAnimationCoordinator: coordinator)
guard let button = UIScreen.mainScreen().focusedView as? UIButton else {
return
}
switch button.tag {
case FocusedButtonTag.First.rawValue:
...
case FocusedButtonTag.Second.rawValue:
...
case FocusedButtonTag.Third.rawValue:
...
case FocusedButtonTag.Fourth.rawValue:
...
default:
break
}
}
user4151918