我一直在尝试将触摸/手势事件从topView发送到底部视图的各种可能性。我正在使用Open框架GLView。我可以将数据从一个类发送到子类,但RMMapView仍然不会覆盖手势和触摸事件。我尝试过使用触摸/手势和Hittest,但是对于所有这些我都无法控制mapview。这是我试图转发泛事件的地方。
我在EAGLView.h中做了什么 https://github.com/openframeworks/openFrameworks/blob/master/addons/ofxiPhone/src/EAGLView.h 图层类:
UIPanGestureRecognizer *panGestureRecognizer = [[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)] autorelease];
panGestureRecognizer.minimumNumberOfTouches = 1;
panGestureRecognizer.maximumNumberOfTouches = 1;
[self addGestureRecognizer:panGestureRecognizer];
- (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer
{
NSLog(@"EAGLEVIEW Pan");
for (UIView *view in [ofxiPhoneGetUIWindow() subviews])
{
if([view isKindOfClass:[RMMapView class]])
{
[view handlePanGesture:recognizer];
// [view panGestureRecognizer delegate self];
// [self addGestureRecognizer:recognizer];
}
}
}
https://github.com/route-me/route-me/blob/master/MapView/Map/RMMapView.m RMMapview的子类:
if (self) {
UIPanGestureRecognizer *panGestureRecognizer = [[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)] autorelease];
[panGestureRecognizer setDelegate:self];
panGestureRecognizer.minimumNumberOfTouches = 1;
panGestureRecognizer.maximumNumberOfTouches = 1;
NSLog(@"hallo123 %@",self);
[self addGestureRecognizer:panGestureRecognizer];
- (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer
{
NSLog(@"pan");
[recognizer setDelegate:self];
[super handlePanGesture:recognizer];
}