8

iOS 9 ストーリーボードを使用して tvOS アプリを作成しています。

アプリには UICollectionView があります。Assets.xcassets コレクションに Front、Middle、および Back アセットを含む Apple TV 画像スタックを定義しました。

ユーザーが 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 に答える