gpt4 book ai didi

ios - GMSAutocompleteViewController 删除 "cancel"按钮

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

我正在尝试删除 ios 版谷歌地图 API 的 GMSAutocompleteViewController 中的默认“取消”按钮。我该怎么做呢?这可能吗?

在此处输入图像描述

enter image description here

最佳答案

试试这个您可以通过 UISearchBar Delegate 方法禁用取消按钮。

func searchBarTextDidBeginEditing(searchBar: UISearchBar) {
searchBar.setShowsCancelButton(false, animated: false)
}

func searchBarTextDidEndEditing(searchBar: UISearchBar) {
searchBar.setShowsCancelButton(false, animated: false)
}

如果您使用的是 CustomSearchBar

自定义搜索栏.swift

import UIKit

class CustomSearchBar: UISearchBar {

override func layoutSubviews() {
super.layoutSubviews()
setShowsCancelButton(false, animated: false)
}
}

关于ios - GMSAutocompleteViewController 删除 "cancel"按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60068872/

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