The Hit List Diary #9 – Table Footer Views

In a similar vein to the last instalment, I thought I’d take a quick look at some undocumented details of table footer views this time.

At first glance, footers are pretty boring. They get tacked on at the bottom of everything else in the table, and have no effect on scrolling. Yawn. But if you look closely, there’s a few interesting nuances for plain styled table views (i.e. not the “grouped” appearance).

Normally when you use a plain styled UITableView it draws extra grid lines underneath the table content. These are visible when the table has only a small amount of content, or when you drag the table past its content size, in order to temporarily reveal what’s hiding down there. I always think these lines represent in a way the “potential” for new content to be tacked onto the list.

When you stick in a footer view, it no longer makes sense for those grid lines to appear, as they’d conflict with the footer, so UITableView stops doing that. It goes further even, drawing a solid rule all the way across between the footer and the cell above — rather than the usual inset that separator lines tend to get. (Note: I've found this to be pretty buggy, often waiting until a tap on the footer view before drawing straightens itself out, or sometimes flat-out refusing to draw the line at all).

But what if you want a plain table, with no extra gridlines, and no footer view either — or at least no solid line for the footer?

Well, sneakily it turns out, if you set .tableFooterView to be an empty UIView of 0 height then the above is exactly what you’ll get.

© Mike Abdullah 2007-2015