运行此GeoFire查询时,我只能让一个引脚留在地图上。它将所有这些都简单地放在了一起,但是剩下的就是最后一个。我希望所有注释留在地图上。这是代码:
if location != nil {
let center = location.coordinate
// Query location by region
let span = MKCoordinateSpanMake(0.1, 0.1)
let region = MKCoordinateRegionMake(center, span)
regionQuery = geoFire?.query(with: region)
queryHandle = regionQuery.observe(.keyEntered, with: { (key, location) in
//print("Key '\(key)' entered the search area and is at location '\(location)'")
self.annot.coordinate = (location!.coordinate)
self.annot.title = key
self.mapView.addAnnotation(self.annot)
print(self.annot.coordinate)
})
queryHandle = regionQuery.observe(.keyExited, with: { (key, location) in
})
}