If I can offer an alternative, UICollectionView has a cool delegation method called
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { }
which can handle clicking on this cell ... if you are looking for specific events that will happen, for example, if the image changes to the state of the button, you can hard-code the code that ... when they press the button, one thing when they release the button do another thing ....
according to the documentation also
UIControlStateSelected The selected state of the control. For many controls, this state does not affect behavior or appearance. But other subclasses (for example, the UISegmentedControl class) may have a different appearance depending on the selected state. You can get and set this value through the selected property.
in a slovenly situation .. for UIButton the "Selected State" does nothing ...
if the button is supposed to fade when it is pressed and it doesn't, then you might have to do it programmatically if, but I'm not quite sure what you are trying to do ...
dimming function is in highlighted state
UIControlStateHighlighted Highlighting the state of the control. The control enters this state when a touch enters and exits during tracking and when a touch event occurs. You can get and set this value through the selected property.
in simple conditions, you touch the highlighted button
to make sure the button changes state correctly, you can do something like this
[button addTarget:self action:@selector(functionToCall:) forControlEvents:UIControlEventAllTouchEvents]; NSLog(@"Selected: %i", button.selected); NSLog(@"Highlighted: %i", button.highlighted); NSLog(@"Normal State or not: %i", button.state);
"functionToCall is called when any type of touch even happens with a button, and with this function you can have these 3 NSLogs that will print different UIControlState values ββon your console, this will show that the button is working correctly and show that it could be an error UIViewCollection, if it is a UICollectionView ... then you have to programmatically smooth the button: 3
hope this helps!