UISearchBar放大镜图标在搜索栏之外

问题描述 投票:0回答:1

当搜索栏处于非活动状态且占位符太大时,放大镜图标会移到搜索栏之外。谁知道如何解决这个问题?什么都没有enter image description here

     lazy var searchBar: UISearchBar = {
        let searchBar = UISearchBar()
        searchBar.autocorrectionType = .yes
        searchBar.autocapitalizationType = .none
        searchBar.placeholder = ChangeToLanguage(SEARCH_LABEL_PLACEHOLDER_SEARCHMODULES)
        searchBar.delegate = self
        searchBar.isTranslucent = false
        let searchBarTextField = searchBar.value(forKey: "searchField") as? UITextField
        searchBarTextField?.tintColor = GlobalTintColor
        searchBar.barTintColor = GlobalTintColor
        return searchBar
    }()
ios swift uisearchbar
1个回答
-1
投票

尝试通过抓住附在UITextField上的UISearchBar调整搜索栏图标的位置,如本文所述。 https://stackoverflow.com/a/36594565/2740582

© www.soinside.com 2019 - 2024. All rights reserved.