我的应用程序使用“放置自动完成”。
请帮帮我。
我想改变:
1-取消按钮文本和字体
2-主文本字体和辅助文本字体
3-错误和消息文本字体
4-“重试”按钮文本和字体
import UIKit
import GooglePlaces
class ViewController: UIViewController {
// Present the Autocomplete view controller when the button is pressed.
@IBAction func autocompleteClicked(_ sender: UIButton) {
let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
present(autocompleteController, animated: true, completion: nil)
}
}
extension ViewController: GMSAutocompleteViewControllerDelegate {
// Handle the user's selection.
func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {
print("Place name: \(place.name)")
print("Place address: \(place.formattedAddress)")
print("Place attributions: \(place.attributions)")
dismiss(animated: true, completion: nil)
}
func viewController(_ viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: Error) {
// TODO: handle the error.
print("Error: ", error.localizedDescription)
}
// User canceled the operation.
func wasCancelled(_ viewController: GMSAutocompleteViewController) {
dismiss(animated: true, completion: nil)
}
// Turn the network activity indicator on and off again.
func didRequestAutocompletePredictions(_ viewController: GMSAutocompleteViewController) {
UIApplication.shared.isNetworkActivityIndicatorVisible = true
}
func didUpdateAutocompletePredictions(_ viewController: GMSAutocompleteViewController) {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
}
}
https://developers.google.com/places/ios-api/autocomplete#add_a_full-screen_control
最佳答案
很遗憾,GMSAutocompleteViewController
不支持更改UI元素的字体。
关于ios - 如何更改Google Place Autocomplete中的取消按钮文本和字体?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43445729/