如何最小化 imageView TVOS Focus CollectionView 的阴影 Swift

How to minimize shadow from imageView TVOS Focus CollectionView Swift

我有一个 UICollectionView 和上面的单元格。当我关注单元格时,imageView adjustsImageWhenAncestorFocused。我的目标是让这个影子小很多。

在我的函数中我不使用 adjustsImageWhenAncestorFocused 我手动更改图像的大小 :

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
           }
    }

这样你就不用处理影子了。希望这有帮助