I am creating a tvOS application and I want to use parallax images on several buttons. From the docs :
To include images in parallax in your application:
- Create a UIImage object.
- You download an image in different ways depending on whether the image is included in the application bundle or if the image is uploaded.
- Downloading packages using imageNamed :.
- Uploaded File - Download images using imageWithContentsOfFile :.
- Create a new UIImageView object using the uploaded images.
- If the UIImageView is part of another view, set the UIImageView parameter to the ImageWhenAncestorFocused parameter in YES.
I know what is written there UIImageView, but I was hoping to make the same effect on UIButtonas the application icons on the main screen.
I created a cover, made a stack in the asset catalog, and uploaded the image using imageNamed:, but UIButtondoes not behave like a parallax image. It does not act like the icons on the home screen do. It looks like a flat image.
Is there anything else I need to enable in order to UIButtonbehave like application icons on the main screen?
UIButton* quitGame = [[UIButton alloc] initWithFrame:rectWithNewX(playAgain.frame, 985)];
[quitGame setImage:[UIImage imageNamed:@"quit.lsr"] forState:UIControlStateNormal];
[quitGame setAdjustsImageWhenHighlighted:YES];
fadeIn(quitGame, self.view, 0.5);
source
share