-1

here is the code for my searchBar

self.searchResultsController = ({
            let controller = UISearchController(searchResultsController: nil)
            controller.searchResultsUpdater = self
            controller.dimsBackgroundDuringPresentation = false
            controller.hidesNavigationBarDuringPresentation = false
            controller.searchBar.sizeToFit()
            controller.searchBar.placeholder = "Type your word here"
            //dcontroller.view.backgroundColor = UIColor.blackColor()
            controller.searchBar.barTintColor = UIColor.blackColor()

            self.tableVw.tableHeaderView = controller.searchBar

            return controller

        })()

when i click on search bar the code becomes left align but before that it is always scattered

Sajjad Aims
  • 99
  • 3
  • 12

1 Answers1

-7

You can use whitespace to achieve this!!

  let searchBar: UISearchBar = UISearchBar()  //your searchbar
    searchBar.placeholder = "Search                  " 

Hope this will help :)

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75