touchesBegan in UIView not being called

cocoa-touch, uiview

Solution

I just found the answer to this. I realised that the superview of the `UIView` has the `userInteraction` set to disabled (which is the default value). So when I enabled the `userInteraction` of the superview, the touches are now recognised.

Problem

I know that this question must have been answered plenty of times already, but I have no idea why the `touchesBegan:` is not called in my `UIView`. Before I added it in my app, I made a trial project to do some tests. What I did was subclass a `UIView` where the `touchesBegan:` is implemented and add this as a subview of another view. The superview has a button which shows the subclassed `UIView` once clicked. Everything works as expected. However, when I did the same thing in my existing app, the `touchesBegan:` method, as well as the `touchesMoved:`, were never called. Can anyone explain what could be preventing the methods from being called?

Original source