I want to have an highlighted image to be shown when i click on an UIImageView. I came across about highlightedImage and tried it like below.
myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1.png"] highlightedImage:[UIImage imageNamed:@"1_highlighted.png"]];
But, highlighted image is not working at all. When i click on an UIImageView (1.png), it doesn’t show the highlighted image (1_highlighted.png).
Could someone guide me how can i do this?
Thank you!
Clicking on an image view won’t set it to the highlighted image. Image views have no user interaction by default.
If you want this action, you need to enable user interaction on the image view and add an action to it.
You can toggle between the two images by setting the highlighted state in code: