I need to set up a view that fills in the content area of a UITableView, and that is displayed whenever that table view is empty, hidden otherwise. That view contains an image, a label, and a button to perform a simple action. I was hoping to achieve two things:
1) leverage the backgroundView property of UITableView, and
2) leverage the storyboard as much as possible while minimizing the amount of code (maybe use a container view?).
However, I am not sure what is the best way to go about this. Insights appreciated, especially if you have already implemented this solution yourself.
You can probably do this a bunch of ways, but the easiest (conceptually) seems to be just use a container view that has two subviews:
UITableViewthat is visible when it's not empty.UIViewthat holds your image/label/button that is visible whenUITableViewis empty.Simply change their visibility depending on the content of the
UITableViewEven if you only use the
UITableViewand set it'sbackgroundViewto be theUIViewto display when theUITableViewis empty, virtually the same amount of work has to be done (you still have to create both views).