作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试向 map 添加两个注释。该 map 工作正常,但当我尝试添加注释时,出现上述错误。这是与此相关的代码部分。
//temporary nearby locations list
//temple tooth
var templeToothMarker = MKPointAnnotation()
var templeToothLocation = CLLocationCoordinate2D(latitude: 7.294715, longitude: 80.639858)
templeToothMarker.coordinate(templeToothLocation)
templeToothMarker.title = "Kandy Dalada Maligawa"
templeToothMarker.subtitle = "Historic Religious place"
//botanical gardens
var botanicalGardenMarker = MKPointAnnotation()
var botanicalGardenLocation = CLLocationCoordinate2D(latitude: 7.294715, longitude: 80.639858)
botanicalGardenMarker.coordinate(templeToothLocation)
botanicalGardenMarker.title = "Royal Botanical Gardens"
botanicalGardenMarker.subtitle = "Historic Religious place"
//load markers to map
map.addAnnotations([templeToothMarker, botanicalGardenMarker])
错误出现在
templeToothMarker.coordinate(templeToothLocation)
和
BotanicalGardenMarker.coordinate(templeToothLocation)
行。我感到困惑,因为我将正确类型的参数传递给 coordinate
方法。这里可能出了什么问题?
最佳答案
这很简单。坐标它是一个属性,而不是一个方法。你只需要设置如下:
botanicalGardenMarker.coordinate = botanicalGardenLocation
关于ios - 无法在 swift 中调用非函数类型 'CLLocationCordinate2d' 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34773736/
我是一名优秀的程序员,十分优秀!