First of all, you must set the button type to Custom Type . By individual type, you will not get more system animations, so you have to do all the animations yourself.
didUpdateFocusInContext UIViewController, UIButton, .
, UIButton. .
let scale = 1.1
layer.borderColor = UIColor.redColor().CGColor
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
if context.nextFocusedView == self {
coordinator.addCoordinatedAnimations({ () -> Void in
self.transform = CGAffineTransformMakeScale(scale, scale)
self.layer.borderWidth = 2
}, completion: nil)
}
else {
coordinator.addCoordinatedAnimations({ () -> Void in
self.transform = CGAffineTransformIdentity
self.layer.borderWidth = 0
}, completion: nil)
}
}