ios - 谷歌自动完成 Swift UITextField
<p><p>有没有人遇到过有关如何在 UITextField 上添加 GoogleAutoComplete 的任何资源。我只看过有关如何将搜索栏添加到导航 Controller 或过时且充满错误的教程。我想将它添加到 UITextField。尚未在 GitHub 上找到任何适用于 Swift 4 的有效解决方案。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p><code>import GooglePlaces</code> 到您的文件中,然后将 <code>UITextField</code> 文本传递到此方法中:-</p>
<pre><code>let placeClient = GMSPlacesClient.init()
let filter = GMSAutocompleteFilter()
filter.type = .establishment
filter.country = "in" //in for India (Only India address will be searched)
placeClient.autocompleteQuery("Pass your text here", bounds: nil, filter: filter) { (results, error) in
if let err = error {
print("Autocomplete error \(err)")
return
}
if let results = results {
// show result in your table view
}
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 谷歌自动完成 Swift UITextField,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/48145221/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/48145221/
</a>
</p>
页:
[1]