[英]UISearchBar magnifying glass icon goes outside searchbar
当搜索栏处于非活动状态且占位符太大时,放大镜图标将移到搜索栏之外。 有人知道如何解决这个问题吗? 没有
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
}()
如本文所述,尝试抓住与UISearchBar
相连的UITextField
来调整搜索栏图标的位置。 https://stackoverflow.com/a/36594565/2740582
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.