touchesBegan not called in a UIView subclass

假如想象 提交于 2019-12-02 00:00:48

问题


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?

来源:https://stackoverflow.com/questions/10061239/touchesbegan-not-called-in-a-uiview-subclass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!