ios - 在 Swift 2 中模糊使用 'kGMSMarkerAnimationPop' 错误

标签 ios swift google-maps ios9

我在尝试为 GMSMarker 设置动画时遇到错误,我已按照 Google 文档和各种指南进行操作,但它一直返回错误,下面是我的代码:

func placeMarker(coordinate: CLLocationCoordinate2D) {
    if locationMarker != nil {
        locationMarker.map = nil
    }

    locationMarker = GMSMarker(position: coordinate)
    locationMarker.icon = GMSMarker.markerImageWithColor(purple)
    locationMarker.appearAnimation = kGMSMarkerAnimationPop
    locationMarker.snippet = "The best place on earth."
    locationMarker.map = mapView
}

返回错误 Ambiguous use of 'kGMSMarkerAnimationPop'

如有任何帮助,我们将不胜感激!

最佳答案

至少在 1.12.3 之前,升级 google map pod 是行不通的。

  1. 将 GMSMarker.h 中的 GMSMarkerAnimation 更改为:

    typedef enum {
      /** No animation (default). */
      kGMSMarkerAnimationNone = 0,
    
      /** The marker will pop from its groundAnchor when added. */
      kGMSMarkerAnimationPop,
    } GMSMarkerAnimation;
    

    为此:

    typedef NS_ENUM(NSInteger, GMSMarkerAnimation){
      /** No animation (default). */
      kGMSMarkerAnimationNone = 0,
    
      /** The marker will pop from its groundAnchor when added. */
      kGMSMarkerAnimationPop,
    } ;
    
  2. 改变

    locationMarker.appearAnimation = kGMSMarkerAnimationPop

    locationMarker.appearAnimation = GMSMarkerAnimation.Pop

关于ios - 在 Swift 2 中模糊使用 'kGMSMarkerAnimationPop' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34656475/

相关文章:

ios - UICollectionView 委托(delegate)方法 cellForItemAtIndexPath :indexPath not called from sizeForItemAtIndexPath

ios - 为什么我不能创建 NSLayoutConstraint 类型的数组?

javascript - Google map 地理编码多条线

ios - 滚动到 UICollectionView 中的下一个单元格

ios - 通用链接不起作用

ios - 动画 UIView 形状及其内容

ios - 快速播放录制的音频

ios - Google map 无法在 iOS 中加载,错误 -999

android - 如何在谷歌地图信息窗口中显示阿拉伯文字?

javascript - 谷歌地图行为怪异(随机工作或抛出错误)(TypeError : Cannot read property 'maps' of undefined)