谷歌地图iOS标记触摸显示标题

时间:2016-03-08 12:47:46

标签: objective-c google-maps google-maps-markers google-maps-sdk-ios

我现在在我的应用程序中显示了一些显示应用程序的代码,在触摸时它会存储触摸标记的位置,并将动画到该标记位置。我有一个标记用于每个标记(我将使用该标记通过数据库访问标记ID的信息)。

当我用标题触摸标记时,它会显示在标记上方的白色框中,这是我无法摆脱的。我似乎无法在网上找到有关此内容的任何信息,而且我的代码中没有任何内容可以创建白盒子。我将粘贴下面的代码。

感谢。

- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)myMarker {
   // NSString* title = myMarker.title;
    CLLocationCoordinate2D coord = myMarker.position;
    latitude2 = coord.latitude;
    longitude2 = coord.longitude;
    [mapView animateToZoom:20];
}

-(void)addMyLocationMarker
{
    mapIcon = @"smallmapicon";
    myMarker.map = nil;
    CLLocationCoordinate2D coordi = CLLocationCoordinate2DMake(myLatitude,myLongitude);
    myMarker=[GMSMarker markerWithPosition:coordi];
    myMarker.map = self.mapView;
    myMarker.appearAnimation = kGMSMarkerAnimationPop;
    myMarker.title = @"Test";
    UIImage * image = [UIImage imageNamed:mapIcon];
    CGSize sacleSize = CGSizeMake(55, 55);
    UIGraphicsBeginImageContextWithOptions(sacleSize, NO, 0.0);
    [image drawInRect:CGRectMake(0, 0, sacleSize.width, sacleSize.height)];
    UIImage * resizedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    myMarker.icon = resizedImage;
    NSLog(@"movement");

}

1 个答案:

答案 0 :(得分:0)

如果您不想打开信息窗口,请设置以下属性:

mapView.selectedMarker = nil;

像,

- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)myMarker {

//set selectedMarker to nil on Mapview

mapView.selectedMarker = nil;

}