3.0 SDK にバグがあり、リアルタイムのズームが無効になり、MKMapView のズームイン ジェスチャがインターセプトされますか? タップイベントを検出できるように、本当に単純なコードがいくつかありますが、2 つの問題があります。
- ズームイン ジェスチャは常にズームアウトとして解釈されます
- ズーム ジェスチャはどれも、マップのビューをリアルタイムで更新しません。
hitTest で「マップ」ビューを返すと、MKMapView 機能はうまく機能しますが、イベントをインターセプトする機会がありません。
何か案は?
MyMapView.h:
@interface MyMapView : MKMapView
{
UIView *map;
}
MyMapView.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];
}