当搜索栏处于非活动状态且占位符太大时,放大镜图标会移到搜索栏之外。谁知道如何解决这个问题?没有
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
}()
答案 0 :(得分:-1)
尝试按照本文中提到的UITextField
附加UISearchBar
来调整搜索栏图标的位置。
https://stackoverflow.com/a/36594565/2740582