ios - UISearchController doesn't hide view when pushed -
i using uisearchcontroller display search bar , results within uitableview. managed set correctly, when search results , select 1 of rows in tableview, , push new view controller navigation stack, expect search bar not visible anymore. however, when try this, search bar first view controller visible in 2nd view controller:
if (self.searchcontroller == nil) { self.searchcontroller = [[uisearchcontroller alloc] initwithsearchresultscontroller:nil]; self.searchcontroller.searchresultsupdater = self; self.searchcontroller.dimsbackgroundduringpresentation = no; self.searchcontroller.searchbar.scopebuttontitles = @[]; self.searchcontroller.searchbar.delegate = self; self.tableview.tableheaderview = self.searchcontroller.searchbar; }
one option call self.searchcontroller setactive:no]
inside of didselectrowatindexpath:
there isn't way without distracting animation of bringing down search bar each time search results selected from.
does have same problem? there way tell uisearchcontroller hide search bar when pushed? worked fine when using uisearchdisplaycontroller
put in viewdidload:
swift:
self.definespresentationcontext = true
objective-c:
self.definespresentationcontext = yes;
this solved problem me.
Comments
Post a Comment