我已经成功实施了GMSPlacePicker Xcode 7.3.1,Swift 2.2。对话框显示但以英文显示。不关心手机的语言。如何更改对话框表单的标题"选择一个位置"到了"其他东西"?
对于总是需要查看某些代码的人,下面是我显示选择器的代码。目标C的答案也是受欢迎的:
// MARK: - Target Action Methods
func didTapSelectFromMap() {
DLog("current location: \(locationManager.location)")
guard let location = locationManager.location else {
return
}
let center = CLLocationCoordinate2DMake(location.coordinate.latitude, 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.pickPlaceWithCallback({ (place: GMSPlace?, error: NSError?) -> Void in
if let error = error {
let ac = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.ActionSheet)
let ok = UIAlertAction(title: "Ok", style: .Default, handler: { (action) in })
ac.addAction(ok)
dispatch_async(dispatch_get_main_queue(), {
self.presentViewController(ac, animated: true, completion: nil)
})
print("Pick Place error: \(error.localizedDescription)")
return
}
self.processPlace(place)
})
}