Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton subview in UICollectionViewCell not changing control state

I have a UICollectionView where each UICollectionViewCell has a UIButton as a subview. The UIButtons respond to taps no problem (their targets get fired), but the button itself does not change to the selected state (no change in look and feel of the button). I have a hunch it's because of the UICollectionViewCell not properly forwarding its touch events to the button, but I'm not sure. Even if that's so, how do I set things up so that the button's state changes properly in this scenario?

like image 405
Jamie Forrest Avatar asked May 03 '13 19:05

Jamie Forrest


1 Answers

The UIScrollview (and thus UICollectionView too) has a property called delaysContentTouches, by default it is set to YES, change this to NO and your button should highlight like it is supposed to.

like image 120
d c Avatar answered Oct 01 '22 20:10

d c