swift - How to change text of navigation bar (UISearchController)? -


i have created navigation bar uisearchcontroller.

below code:

@ibaction func showsearchcontroller(sender: anyobject) {     let searchcontroller = uisearchcontroller(searchresultscontroller: searchresultcontroller)     searchcontroller.searchbar.delegate = self     /*     searchcontroller.searchbar.placeholder = "hhhhhhhhhhh"     searchcontroller.navigationitem.title = "hhhhhhhhhhh"     searchcontroller.navigationcontroller?.navigationbar.topitem?.title = "hhhhhhhh"    -->i try these codes change*/      self.presentviewcontroller(searchcontroller, animated: true, completion: nil) } 

but can't change text.

enter image description here

var searchtextfield = searchcontroller.searchbar.valueforkey("_searchfield") as! uitextfield searchtextfield.placeholder = "your custom text" 

enter image description hereuse change place holder text


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -