Mos*_*fat 7 ios google-places-api gmsplacepicker
亲爱,
我想限制用户仅从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 = ""
}
})
}
Run Code Online (Sandbox Code Playgroud)
我相信应该有配置或标志可以删除此选择.
非常感谢您的支持.谢谢
| 归档时间: |
|
| 查看次数: |
502 次 |
| 最近记录: |