3

I am trying to mimic the GLPaint app and I have a TDPaintingView that has methods for -(void)touchesBegan... as well touchesMoved, touchesEnded, and touchesCanceled. However, I am not seeing any of them fire.

I have a TDAppDelegate that is hooked up to a Window in IB and a TDPaintingView in IB. The initWithCoder method for my TDPaintingView definitely fires, so I know it is being initialized. Furthermore, I can see from logging the object TDPaintingView from the context of applicationDidFinishLaunching that it is definitely there. When I change the view in trivial ways in IB (making bg red for example) it is reflected on simulator.

However, my view doesn't receive touches, and it's driving me crazy!

I set a breakpoint on -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event and it never stops, regardless of where I touch on the screen.

My TDPaintingView has no subviews, and it explicitly defines methods for those touches actions.

Where am I going wrong?

6
  • Is your view's userInteractionEnabled flag set to YES? You can either set it in code, or by checking the "User Interaction Enabled" checkbox in the xib file.
    – Kurt Revis
    Apr 8, 2012 at 8:15
  • I should have mentioned, in the mainwindow xib file, under the item for the view, User Interaction Enabled is YES and set that way by default in IB I believe... Apr 8, 2012 at 8:19
  • Could you show the code relevant to its initialization? Or if you are using IB, then a screenshot of the pane that configures it? Otherwise we will be just guessing
    – nacho4d
    Apr 8, 2012 at 8:44
  • Did you find a solution? I have two projects, but based on GLPaint. As far as I can see, there are no significant differences between the two projects, however one fires touchesBegan and the other doesn't. The root view receives touches, and could hand it to the paintview, but I like it better that the painting view receives the touches directly. I'll keep digging for an answer.. and share if I find it.
    – Johan
    Dec 7, 2012 at 14:03
  • I stripped down the project that didn't work, keeping only the essentials. And now it works. So.. There is something that we both did that prevents it from working, not something that needs to be done..
    – Johan
    Dec 7, 2012 at 15:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.