0

I want to change text alignment of Placeholder in Searchcontroller searchBar.

I used this Swift code to create search bar in my navigation controller:

@IBAction func searchwithAddress(_ sender: Any) {
    let searchController = UISearchController(searchResultsController: searchResultController)
    searchController.searchBar.delegate = self
    searchController.obscuresBackgroundDuringPresentation = false

    searchController.searchBar.becomeFirstResponder()
    definesPresentationContext = true
    self.present(searchController, animated: true, completion: nil)

}

How can I use textalign for my searchbar?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253

1 Answers1

0

You can refer this link to change the alignment of Placeholder in search bar.

But I would suggest to create your own search bar using UITextField and UIImageView, and responding to the delegate calls.

sunshine
  • 21
  • 5