开发者

iPhone SDK - Forwarding touches from a UIViewController to a subview

I have a UIViewController with a subclass of UIView on it called customSubView1. Then on customSubView1 I have another subclass of UIView called customSubView2.

I can capture开发者_开发百科 all the events for touches on all the subviews when I put touchesBegan/touchesMoved/etc in the UIViewController class. But I want to be able to process them in my custom classes.

I keep reading that the UIViewController class needs to 'forward' the touch events to the subviews, but I haven't been able to find any example code to do this. Does anyone have any idea?

Many thanks, Brett


Implement the touches... methods in your views.


Try to set for you UIView object userInteractionEnabled property:

myUIView.userInteractionEnabled = YES;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜