TvOS: creating a parallax effect on a UICollectionViewCell

I am using iOS 9 storyboards to create a tvOS application.

The application has a UICollectionView. I defined an Apple TV image stack that contains the Front, Middle, and Back element in my Assets.xcassets collection.

When a user selects a UICollectionViewCell, I would like to have a โ€œhighlightโ€ effect similar to that of the application icon, where the user can โ€œcircleโ€ a finger on the Siri remote control to set the parallax effect and shine.

Does anyone have any experience?

+8
objective-c tvos
source share
1 answer

Just found the answer. Hope this helps someone else:

- (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; } 
+13
source share

All Articles