ios - UISearchController like Maps of Apple -


i'm developing ios app using objective c. implemented uisearchcontroller , works fine wanted maps of apple it's not case buttons on navigation bar doesn't disappear here screenshot .

any ideas ?!

before click

after click

try use delegate method of uisearchbar this

on begin editing of uisearchbar remove navigation button this

func searchbarshouldbeginediting(searchbar: uisearchbar) -> bool {     self.navigationitem.leftbarbuttonitem = nil     self.navigationitem.rightbarbuttonitem = nil     return true } 

on cancel button click add navigation button again

func searchbarcancelbuttonclicked(searchbar: uisearchbar) {     //add code using set navigation buttons , uisearchbar } 

hope you.