我有BooksEAGLView
并且它有UIButton
用于接收触摸事件。然后我的增强现实叠加的目的是添加叠加视图,BooksEAGLView
然后我的按钮没有接收到触摸事件。
我怎样才能获得两个视图的触摸事件。
bookOverlayController = [[BooksOverlayViewController alloc]initWithDelegate:self];
// Create the EAGLView
eaglView = [[BooksEAGLView alloc] initWithFrame:viewFrame delegate:self appSession:vapp];
[eaglView addSubview:bookOverlayController.view];
[self setView:eaglView];
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
return ([touch.view.superview isKindOfClass:[BooksEAGLView class]] || [touch.view.superview isKindOfClass:[TargetOverlayView class]]);
}
触摸事件:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
NSLog(@"hitTest:withEvent called :");
NSLog(@"Event: %@", event);
NSLog(@"Point: %@", NSStringFromCGPoint(point));
NSLog(@"Event Type: %d", event.type);
NSLog(@"Event SubType: %d", event.subtype);
NSLog(@"---");
return [super hitTest:point withEvent:event];
}