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.
var searchtextfield = searchcontroller.searchbar.valueforkey("_searchfield") as! uitextfield searchtextfield.placeholder = "your custom text"
Comments
Post a Comment