8

我正在使用 iOS 9 Storyboards 创建一个 tvOS 应用程序。

该应用程序有一个 UICollectionView。我在 Assets.xcassets 集合中定义了一个 Apple TV 图像堆栈,其中包含一个 Front、Middle 和 Back 资产。

当用户突出显示 UICollectionViewCell 时,我希望有一个类似于应用程序图标的“突出显示”效果,用户可以在 Siri 遥控器上“圈出”他们的手指以显示视差效果并发光。

有人对这个有经验么?

4

1 回答 1

15

刚刚找到答案。希望这对其他人有帮助:

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"CameraCell" forIndexPath:indexPath];

    UIImage *image = [_cameras objectAtIndex:indexPath.row];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.userInteractionEnabled = YES;
    imageView.adjustsImageWhenAncestorFocused = YES;
    imageView.frame = CGRectMake(0, 0, 853, 560);
    [cell addSubview:imageView];

    return cell;
}
于 2015-09-26T00:25:10.407 回答