touchesBegan not called in a UIView subclass

2019-02-25 13:32发布

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?

0条回答
登录 后发表回答