ios - UISearchDisplayController configure "no results" view not to overlap tableFooterView -
i have list of things provided system (e.g. brands) not user editable have change time time.
context
these things displayed in table view , searchable using default uisearchdisplaycontroller. however, list of things surely isn't complete want give users ability request addition of other things list. added table footer view both original table view , search results table view, provides button send mail.
problem
it works fine long search results table view still contains entries. table footer view displayed below search results , fine.
however, if no results found search term, search display controller displays "no result" label centered on table view. looks great, this:
but since tablefooterview still displayed (which want be!) "no results" label overlaps footer view , looks crappy:
i think in case don't need "no result"s label, since footer view makes reasonable clear there no results , it. don't mind either, long doesn't overlap.
question
how can either
- make search view not display "no results" label
- or configure how displayed (-> not overlapping)
if not possible i'm open suggestions others ways of displaying footer view (not footer), not have problem. solution since can use in both cases (normal table view , search results table view) without having change anything.
first of all, important keep in mind using uisearchdisplaycontroller
trade-off between customizability , convenience. lot of automatic stuff free, if require lot of customization might not suit needs. works best drop-in solution, , if you'd use it, recommend work app around instead of trying hack behavior.
with said, why don't make uitableview
return single row when there no results? row either empty, display boilerplate text or image (sad face or humorous matches app).
having single row presented, default "no results" label uisearchdisplaycontroller
not shown. default behavior lot of apps, instagram (check out explore tab), kindle , default notes.app, although not using uisearchdisplaycontroller
.
if find workaround doesn't fit app, try making "missing brand" view header view of first section of uisearchresultstableview
(instead of footer view). way, "no results" label displayed below it. combining idea single empty row work better.
a third option insert view on top of uisearchresultstableview
. done every time there no results (properly removing when necessary) or single time, using hidden property show or hide instead.
any other method hiding label hacky, one: https://stackoverflow.com/a/11715841/382834. although easier on current logic, might have negative consequences later on, it's possibly worst path follow.
Comments
Post a Comment