0

iOS6でアプリを開発しています。Apple のマップを使用しています。ユーザーがタップするマップ上のピンをドロップする必要があります。Map で UITapGestureRecognizer を使用してこれを行っています。しかし問題は、ユーザーがタップしてピンをドロップすると、ピンがドロップされた後に Map Delegate メソッド「didSelectAnnotationView」も自動的に呼び出されることです。私も UILongPressGestureRecognizer を使用してみましたが、同じ結果です。これは、iOS 5 の Google マップでは発生しません。iOS 5 では問題なく動作しています。私はそれについて研究を行っていますが、結果を得ることができません。教えてください:

これを処理する方法はありますか。または Apple Map は、動的にピンをドロップする機能を提供します。

ありがとう。

私が書いた次のコード:

- (IBAction)singleTapGestureOccur:(UITapGestureRecognizer *)sender {
CGPoint touchPoint = [sender locationInView:_mapView_View];
CLLocationCoordinate2D cord = [_mapView_View convertPoint:touchPoint toCoordinateFromView:_mapView_View];
MapAnnotation *annotation = [[MapAnnotation alloc] initWithCordinate:cord];
[_mapView_View addAnnotation:annotation];

}

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{
NSLog(@"DidSelectAnnotation");

}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
    if ([[touch.view class] isSubclassOfClass:[MKPinAnnotationView class]]) {
        return NO;
    }else {
        return YES;
    }
}else {
    return YES;
}

}

4

0 に答える 0