As several people have noted, the standard focus behavior of adjustImageWhenAncestorFocused (or system UIButton) isn't friendly to non-rectangular images.
I'd like to reimplement the focus behavior myself, in a didUpdateFocusInContext:withAnimationCoordinator: routine. (As suggested by many people.) There seem to be four effects here: scale up, drop shadow, tilting, and the gloss reflection.
The scale and drop shadow are easy. I did this:
- (void) didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
if (context.nextFocusedView == self) {
[coordinator addCoordinatedAnimations:^(){
self.transform = CGAffineTransformMakeScale(1.1, 1.1);
self.layer.shadowOpacity = 0.5;
self.layer.shadowRadius = 32.0;
self.layer.shadowOffset = CGSizeMake(0, 16);
} completion:nil];
}
if (context.previouslyFocusedView == self) {
[coordinator addCoordinatedAnimations:^(){
self.transform = CGAffineTransformIdentity;
self.layer.shadowOpacity = 0.25;
self.layer.shadowRadius = 4.0;
self.layer.shadowOffset = CGSizeZero;
} completion:nil];
}
}
But I haven't seen any discussion of the tilting and gloss effects. They're tied to the "wiggle" gesture on the remote, and I'm not sure how to get hold of that data.
(Someone mentioned UIMotionEffect, but that looks like it ties to device orientation rather than a wiggle touch gesture.)
Anyone have sample code?