我有一个UICollectionView
和单元格。当我专注于细胞时,imageView adjustsImageWhenAncestorFocused
。我的目标是让这个影子小得多。
答案 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
}
}
这样你就不必处理阴影了。希望这有帮助