The really polished apps use this class particularly well. Look at the iPod application, for example. When there is nothing to display in a table view, the iPod app shows a placeholder view with a pretty icon and some text explaining why the list is empty:
It's these neat little UI touches that set a truly great application apart from a merely adequate one.
I want one of those
It's not rocket science to code such UI behaviour, but why do that when someone's already done it for you?
Mosey on over to the TableViewWithEmptyView Gitorious project and grab my code from there.
Most of that project's files comprise the requisite scaffolding to provide an example demonstrating the class. To use the class in your own project you need only copy over the PGTableViewWithEmptyView.h and PGTableViewWithEmptyView.m files.
Using the class is simple. It works exactly like a standard UITableView, but has one extra property emptyView. Assign this property the UIView you want displayed when there are no items in the table. The rest happens automatically for you.
The empty view fades in and out smoothly for added UI chintz.
To make things even easier, you can wire all this up in your XIB file, so your code need never mention the PGTableViewWithEmptyView class itself. Now that's magic.
I'd be grateful to hear from you if you use this class. Please also feel free to send me any suggestions, improvements, or bug reports.