Swift 将标题和代码段字符串添加到位置数组
我试图在谷歌地图上绘制多个点,带有标题和片段 当前我的数组不接受添加标题和代码段。添加这些标记以使我的for循环能够成功绘制每个标记的最佳实践是什么?最终,我将从一个数据库中检索信息,该数据库将有以下列:title | snippet | latitude | longitudeSwift 将标题和代码段字符串添加到位置数组,swift,Swift,我试图在谷歌地图上绘制多个点,带有标题和片段 当前我的数组不接受添加标题和代码段。添加这些标记以使我的for循环能够成功绘制每个标记的最佳实践是什么?最终,我将从一个数据库中检索信息,该数据库将有以下列:title | snippet | latitude | longitude let locations = [ CLLocationCoordinate2D(latitude: 52.205170, longitude: 0.124800), CLLoca
let locations = [
CLLocationCoordinate2D(latitude: 52.205170, longitude: 0.124800),
CLLocationCoordinate2D(latitude: 52.206382, longitude: 0.120858)
]
for x in locations {
let marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(x.latitude, x.longitude)
//marker.title = x.description
//marker.snippet = x.website
marker.map = self.mapView
}
你说的是什么数组?然后我使用for循环遍历的位置数组。我想为每个纬度和经度坐标添加一个标题和代码段。然后您应该创建一个自定义类型,其中包含坐标、标题和代码段的属性