gpt4 book ai didi

ios - 将 GMSAutocompleteViewController 设置为仅指定特定状态

转载 作者:行者123 更新时间:2023-11-30 11:16:22 24 4
gpt4 key购买 nike

当我单击 GMSAutocompleteViewController 时,它应该只显示建议中的所有状态。我不想要这个领域的城市、国家或其他任何东西。那么这可能吗?

最佳答案

您无法直接过滤状态,Google Auto Complete API 提供了一些过滤器及其预定义的 ENUMS。

let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self

// Set a filter to return only addresses.
let filter = GMSAutocompleteFilter()
filter.type = .address
autocompleteController.autocompleteFilter = filter

present(autocompleteController, animated: true, completion: nil)

GMSAutocompleteFilter.h : ENUMS description below

typedef NS_ENUM(NSInteger, GMSPlacesAutocompleteTypeFilter) {
/**
* All results.
*/
kGMSPlacesAutocompleteTypeFilterNoFilter,
/**
* Geeocoding results, as opposed to business results.
*/
kGMSPlacesAutocompleteTypeFilterGeocode,
/**
* Geocoding results with a precise address.
*/
kGMSPlacesAutocompleteTypeFilterAddress,
/**
* Business results.
*/
kGMSPlacesAutocompleteTypeFilterEstablishment,
/**
* Results that match the following types:
* "locality",
* "sublocality"
* "postal_code",
* "country",
* "administrative_area_level_1",
* "administrative_area_level_2"
*/
kGMSPlacesAutocompleteTypeFilterRegion,
/**
* Results that match the following types:
* "locality",
* "administrative_area_level_3"
*/
kGMSPlacesAutocompleteTypeFilterCity,
};

关于ios - 将 GMSAutocompleteViewController 设置为仅指定特定状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51705065/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com