亲爱的,
我想让用户限制只能从 GMSPlacepicker 中选择地点,而不是让他们选择按“选择此位置”,它只发送没有地名的 Long & Lat。
所以我的问题是删除 GMSPlacePicker 对话框中的“选择此位置”按钮。
这就是我的意思..
这是编写的代码..
@IBAction func LocationChooserPressed(_ sender: AnyObject) {
let center = CLLocationCoordinate2DMake((locationManager.location?.coordinate.latitude)!, (locationManager.location?.coordinate.longitude)!)
let northEast = CLLocationCoordinate2DMake(center.latitude + 0.001, center.longitude + 0.001)
let southWest = CLLocationCoordinate2DMake(center.latitude - 0.001, center.longitude - 0.001)
let viewport = GMSCoordinateBounds(coordinate: northEast, coordinate: southWest)
let config = GMSPlacePickerConfig(viewport: viewport)
placePicker = GMSPlacePicker(config: config)
placePicker?.pickPlace( callback: { (place: GMSPlace?, error: Error?) -> Void in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
if let place = place {
self.nameLabel.text = place.name
self.addressLabel.text = place.formattedAddress!.components(separatedBy: ", ").joined(separator: "\n")
self.chosenLong = String(place.coordinate.longitude)
self.chosenLat = String(place.coordinate.latitude)
} else {
//self.nameLabel.text = "No place selected"
self.addressLabel.text = ""
}
})
}
我相信应该有可以删除此选择的配置或标志。
非常感谢您的支持。谢谢