How to minimize shadow from imageView TVOS Focus CollectionView Swift

I have a UICollectionView and cells on it. When I focus on the cell, imageView adjustsImageWhenAncestorFocused . My goal is that this shadow is much smaller.

+5
source share
1 answer

in my function I don't use adjustsImageWhenAncestorFocused I resize the image manually:

 override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) { if (self.focused) { self.imageView.frame.size.width = self.imageView.frame.width+30 self.imageView.frame.size.height = self.imageView.frame.height+30 self.imageView.frame.origin.x = self.imageView.frame.origin.x - 15 self.imageView.frame.origin.y = self.imageView.frame.origin.y - 15 else { self.imageView.frame.size.width = self.imageView.frame.width-30 self.imageView.frame.size.height = self.imageView.frame.height-30 self.imageView.frame.origin.x = self.imageView.frame.origin.x + 15 self.imageView.frame.origin.y = self.imageView.frame.origin.y + 15 } } 

This way you do not need to deal with shadow. Hope this helps

0
source

Source: https://habr.com/ru/post/1238027/


All Articles