I have a tableview in a tableview controller with a search bar. I want to add an image to the top of it in such a way, that it acts like a navigation bar and doesn't move and essentially shrinks the tableview. I usually use a view controller and add an image to the top, but I can't seem to do the tableviewcontroller. I tried adding a UIView and calling the
tableViewHeader
method, however my search controller disappears and when I scroll down in the tableview, the header disappears and the tableview covers the whole page.
Is there any way of adding sort of a sticky header to the tableview in the tableviewcontroller, so that it stays there and my search controller doesn't disappear.
Add UIImgaeView
in HeaderView
of that TableView
.
Something like that -
let headerImageView = UIImageView.init(frame: Frame)
headerImageView.image = Image
self.tableView.tableHeaderView = headerImageView