我已经成功实现了 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)
})
}