【问题标题】:Google Maps iOS Marker Displaying Title on Touch谷歌地图 iOS 标记在触摸时显示标题
【发布时间】:2016-06-22 10:11:50
【问题描述】:

我的应用程序中现在有一些代码显示一个应用程序,在触摸时它将存储所触摸标记的位置,并将动画到该标记位置。我为每个标记都有一个标题(我将使用该标题通过数据库访问标记 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");

}

【问题讨论】:

  • 所以你不需要那个标题?

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


【解决方案1】:

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

mapView.selectedMarker = nil;

喜欢,

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

//set selectedMarker to nil on Mapview

mapView.selectedMarker = nil;

}

【讨论】:

    猜你喜欢
    • 2018-07-31
    • 2019-10-10
    • 1970-01-01
    • 2017-10-08
    • 1970-01-01
    • 1970-01-01
    • 2013-04-20
    • 1970-01-01
    • 2014-10-08
    相关资源
    最近更新 更多