0

When searchbar is in inactive state and the placeholder is too big, the magnifying glass icon goes outside the searchbar. Anyone knows how to fix this? Nothing 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
    }()
Rakesha Shastri
  • 11,053
  • 3
  • 37
  • 50

1 Answers1

-1

Try adjusting the position of search bar icon by grabbing the UITextField attached to UISearchBar as mentioned in this post. https://stackoverflow.com/a/36594565/2740582

Mahesh De Silva
  • 505
  • 8
  • 20