Table Header Views in StoryBoards Table Header Views in StoryBoards ios ios

Table Header Views in StoryBoards


It looks like one simply drags a control to the top of the table view. I didn't expect it to be that easy.

Before Drop

Before Drop

After Drop

After Drop


You can do this easily by dragging your UIView/UIImageView just below the UITableView in the document outline (instead of the layout).

If you try to drag in the layout instead of document outline the UITableViewCell will jump to the top handling which is frustrating!


Dragging and dropping a view on top of the tableview worked for only one screen size, at least in Xcode 11. It didn't size well on different screens.

I just created a view and left it there behind the tableview in storyboard. I created an IBOutlet for it:

@IBOutlet weak var audioView: UIView!

Then in tableview code I did:

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {    return audioView}func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {    return 142}

It worked well on all screen sizes.