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

时间:2015-12-13 17:51:14

标签: swift tvos

我有一个UICollectionView和单元格。当我专注于细胞时,imageView adjustsImageWhenAncestorFocused。我的目标是让这个影子小得多。

1 个答案:

答案 0 :(得分:0)

在我的功能中我不能使用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
           }
    }

这样你就不必处理阴影了。希望这有帮助