【问题标题】:Custom Google Maps Marker for iOS (GMSMarker)适用于 iOS 的自定义 Google 地图标记 (GMSMarker)
【发布时间】:2015-03-28 18:21:45
【问题描述】:

我正在尝试为 Google 地图创建一个自定义标记,但我的代码给了我一个奇怪的空间视图,如下图所示:

那个白色的视图是什么?如何删除它?应该只有红色的!

-(UIView *)mapView:(GMSMapView *)mapView markerInfoContents:(GMSMarker *)marker{
    UIView *infoView = [UIView new];
    infoView.frame = CGRectMake(0, 0, 290, 192);
    // Setting the bg as red just to illustrate
    infoView.backgroundColor = [UIColor redColor];
    return infoView;
}

【问题讨论】:

    标签: ios google-maps google-maps-sdk-ios


    【解决方案1】:

    我可能有点生疏,但这不是错误的功能吗?

    有一个 markerInfoWindow 和一个 markerInfoContents(您正在使用)。 窗口是整个东西,而内容是一个视图,它将被放置在默认的信息窗口框架中

    看看here

    【讨论】:

      【解决方案2】:

      这个白色背景背后的原因是您使用了错误的委托方法。用这个替换你的代码:

      -(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker{
          UIView *infoView = [UIView new];
          infoView.frame = CGRectMake(0, 0, 290, 192);
          // Setting the bg as red just to illustrate
          infoView.backgroundColor = [UIColor redColor];
          return infoView;
      }
      

      【讨论】:

        猜你喜欢
        • 2017-01-24
        • 2014-10-22
        • 2019-11-14
        • 2017-03-05
        • 2016-02-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多