ios - UISearchController not properly dismissing when going out of scope -
this question has answer here:
i'm building in search functionality app, consists of uitableviews. have added search bar, , can search items properly, when set controller.dimsbackgroundduringpresentation = false
things weird. issue is, want boolean false, since users should able scroll through results , select result see more details.
the behavior i'm seeing following: search bar never dismisses itself, unless press cancel
button, meaning when select cell in table view show details of cell, search bar carries on view, such:
i initialize search controller follows:
self.searchcontroller = ({ let controller = uisearchcontroller(searchresultscontroller: nil) controller.searchresultsupdater = self controller.dimsbackgroundduringpresentation = false controller.searchbar.sizetofit() controller.hidesnavigationbarduringpresentation = false controller.searchbar.searchbarstyle = .minimal controller.delegate = self self.tableview?.tableheaderview = controller.searchbar return controller; })()
and while searching works (updatesearchresultsforsearchcontroller
gets called, apply search , return array, etc), can't seem use search in way, since if select cell while searching, above picture happens, if press cancel, search cleared. appreciated.
you should add following line in viewdidload()
definespresentationcontext = true
see documentation details: definespresentationcontext
Comments
Post a Comment