【发布时间】:2013-01-06 10:21:53
【问题描述】:
在我的应用程序中,我有 2 个透明的 UIViewController 层。
第一层包含UIView 我试图通过触摸识别的对象:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
方法。
问题是,
上面有一个透明的UIViewController。
我尝试在SeconedStackedViewController 上实现触摸事件并创建FirstStackedViewController 的实例并从那里调用相同的方法。方法被调用,但命中测试没有。
代码:
FirstStackedViewController *fsvc = [[FirstStackedViewController alloc]init];
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
[fsvc hitTest:point withEvent:event];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
fsvc = [[FirstStackedViewController alloc]init];
[fsvc touchesEnded:touches withEvent:event];
}
如何覆盖此方法以在FirstStackedViewController 上调用?
如果我能模拟触摸FirstStackedViewController 我认为它会成功
【问题讨论】: