簡體   English   中英

如何在iOS版MapBox SDK上檢測長按手勢?

[英]How can I detect longtap gesture on MapBox SDK for IOS?

如何在iOS版MapBox SDK上檢測到長按手勢?

我嘗試下面的代碼。 但是從未調用mapLongTap。

-(void)mapInit
{
    RMMBTilesSource *offlineSource = [[RMMBTilesSource alloc] initWithTileSetResource:@"tokyo5" ofType:@"mbtiles"];
    mapView = [[RMMapView alloc] initWithFrame:_mapBaseView.bounds andTilesource:offlineSource];
    mapView.zoom = 0;
    mapView.delegate = self;
    mapView.missingTilesDepth = 5;
    mapView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;

    mapView.adjustTilesForRetinaDisplay = YES;    
    UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(mapLongTap:)];
    [longPressGesture setMinimumPressDuration:1.0];

//  [_mapBaseView addGestureRecognizer:longPressGesture];
    [mapView addGestureRecognizer:longPressGesture];

    [self.mapBaseView addSubview:mapView]; 
}

-(void)mapLongTap:(UISwipeGestureRecognizer *)gesture
{
    NSLog(@"LongTap");
}

RMMapView已經具有長按手勢識別器。 請參見-[RMMapViewDelegate longPressOnMap:at:]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM