【问题标题】:unresolved identifier when creating a dotted Polyline in Google Maps iOS API在 Google Maps iOS API 中创建虚线折线时未解析的标识符
【发布时间】:2017-09-08 01:48:52
【问题描述】:

我正在尝试根据我找到的代码here - third answer 创建一个带点的Polyline。我想出了这个:

        // route
        let path = GMSMutablePath()
        // populate path with coordinates here 
        // ...
        let route = GMSPolyline(path: path)
        route.strokeWidth = 3.0
        let styles = [GMSStrokeStyle.solidColor(UIColor(red: 0.945, green: 0.392, blue: 0.278, alpha: 1.0)), GMSStrokeStyle.solidColor(UIColor.clearColor())]
        let lengths = [10,10]
        route.spans = GMSStyleSpans(route.path!, styles, lengths, kGMSLengthRhumb);
        route.map = m_map_view

我得到一个unresolved identifier 错误,因为kGMSLengthRhumb 在我的系统中未被识别为某个有效常量。我正在使用 Swift 2.0。

kGMSLengthRhumb 在哪里,或者我应该放什么?

【问题讨论】:

标签: ios swift xcode google-maps


【解决方案1】:

kGMSLengthRhumb 应替换为GMSLengthKind.rhumb

【讨论】:

  • 这没有提供问题的答案。一旦你有足够的reputation,你就可以comment on any post;相反,provide answers that don't require clarification from the asker。 - From Review
  • 问题是,“kGMSLengthRhumb 在哪里,或者我应该在哪里放什么?”。这明确回答了不需要提问者澄清的问题。 @blueberryfields
  • 请解释为什么替换是正确的 - 即,kGMSLengthRhumb 在某些时候是正确的,但在某些时候发生了变化?另外,请在未来证明这个答案 - 例如,提供相关文档的链接,这样,将来当这可能再次失效时,读者将能够从这个答案中自行找到更正/更新的版本跨度>
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多