Quirk of the Day - UIButton in UIScrollView

The problem - A UIScrollView that contains a bunch of UIButton objects, but the buttons do not respond to touches (i.e. the selectors set by addTarget: … never get called).

A frustrating hour or so reading the documentation and consulting the oracle of stackoverflow didn't help. A classic case of "It should work!".

Then I saw something that triggered a thought …

The complication - Each button has a custom view added as a subview (as an easy way of making the custom view respond to touches).

The solution - Disable user interaction on the button subview (e.g. myView.userInteractinEnabled= NO;) and all is well.

Now I just have to go an remove all the other random changes I made to my code to try and make it work.