3.0 SDK中是否存在禁用MKMapView实时缩放和截取放大手势的错误?我有一些真正简单的代码,所以我可以检测点击事件,但有两个问题:
- 放大手势总是被解释为缩小
- 任何缩放手势都不会实时更新地图的视图。
在 hitTest 中,如果我返回“地图”视图,MKMapView 功能效果很好,但我没有机会拦截事件。
有任何想法吗?
MyMapView.h:
@interface MyMapView : MKMapView
{
UIView *map;
}
我的地图视图.m:
- (id)initWithFrame:(CGRect)frame
{
if (![super initWithFrame:frame])
return nil;
self.multipleTouchEnabled = true;
return self;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
NSLog(@"Hit Test");
map = [super hitTest:point withEvent:event];
return self;
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"%s", __FUNCTION__);
[map touchesCancelled:touches withEvent:event];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event
{
NSLog(@"%s", __FUNCTION__);
[map touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
NSLog(@"%s, %x", __FUNCTION__, mViewTouched);
[map touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
NSLog(@"%s, %x", __FUNCTION__, mViewTouched);
[map touchesEnded:touches withEvent:event];
}