I have a custom UICollectionViewCell that holds a UIButton with an image set. The purpose of this bottom is to allow users who are shopping via the app to add items to a list of their favourite items.
I have 2 versions of the image. One is a default greyed out heart and the other is a black heart. When a user taps to add an item to their favourites this method is fired:
Method fired on tap of heart:
- (void)addToFavouritesButtonTapped
{
NSLog(@"add to favourites button tapped");
}
In my cellForItemAtIndexPath method for my UICollectionView I have this:
_addToFavouritesButton = [cell addFavouriteButton];
[_addToFavouritesButton addTarget:_thisController action:@selector(addToFavouritesButtonTapped) forControlEvents:UIControlEventTouchUpInside];
Upon tapping the heart to save an item to favourites I'd like the image to change to my highlighted version which is the black heart.
How can I achieve this?