vendredi 10 juin 2016

Is it possible to anchor the table view header (not a section header)


All previous questions are relating to anchoring table view section headers, but I would like to know if its possible to anchor the main header below the navigation bar?

I'm using a UISearchController and adding its search bar to the table header, which appears thus:

enter image description here

But because the header is not anchored it and the search bar will disappear if the user scrolls:

enter image description here

Therefore I want to know if its possible to anchor the table header below that navigation bar? Can't find any previous questions relating to this, only relating to anchoring section headers. Fiddling around with the various storyboard settings such as bouncing and scrolling wasn't fruitfull.

P.S. Any proposed solutions involving manually adding a search bar to a section header and anchoring that instead is I just know going to lead to too much hassle and problems when the search bar becomes active. Using UISearchController and adding its search bar to the table view header nicely animates the navigation bar out of the way and slides the search bar up and down as it gains/loses first responder status:

enter image description here

All this is handled automatically by the UISearchController automatically simply by adding one line of code (to add the search bar to the header). Therefore I don't want to go down the road of replacing all the UISearchController provided functionality with custom table section headers and so on.


Aucun commentaire:

Enregistrer un commentaire