【问题标题】:Google Maps SDK for IOS - Marker always centered适用于 IOS 的 Google Maps SDK - 标记始终居中
【发布时间】:2014-05-15 14:39:03
【问题描述】:

我正在尝试开发一个可以让用户更改其在地图上的位置的应用。实际上,我有一个标记,它在 mapView:didChangeCameraPosition 事件上将其位置重新绘制到地图相机上,它工作正常,但我看到的问题是性能不够好,因为标记在地图中重新绘制有一些延迟。

我想知道是否有更好的方法来实现这个要求

这是我的实际代码:

- (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position {
      self.marker.position = position.target;  
  }

【问题讨论】:

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


    【解决方案1】:

    您能否在GMSMapView 的顶部添加一个带有标记的UIImageView,位于它的中间?

    【讨论】:

    • 我猜他可能需要带有标记的标注
    • @Nerkatel 是的,但是他也可以手动进行标注。
    • 它可以工作,但是,没有直接涉及使用 GMSMarker 的方法吗?我问是因为当触发某些操作时,我还需要此标记位于地图中的某个静态位置
    【解决方案2】:
    NSString *strLat = [NSString stringWithFormat:@"%f",_message.latitude];
    NSString *strLong = [NSString stringWithFormat:@"%f",_message.longitude];
    NSString *strURL = [NSString stringWithFormat:@"%@center=%@,%@&zoom=15&size=200x200&markers=color:red%%7Clabel:C%%7C%@,%@&key=%@",https://maps.googleapis.com/maps/api/staticmap?,strLat,strLong,strLat,strLong,GOOGLE_API_BROWSER_KEY];
    NSLog(@"strURL %@",strURL);
    strURL = [strURL stringByReplacingOccurrencesOfString:@"%%" withString:@"%"];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-08
      • 1970-01-01
      • 2013-09-20
      • 1970-01-01
      相关资源
      最近更新 更多