I want to display an empty message to the user when the UITableView is empty. There are a few attempts out there including using
backgroundView: MyUILabelstays centered but if you scroll the table view, the message position stays fixed. This looks kind of weird with my current layout.addSubView: This was my currently used solution. Because I added another view auto layout destroyed my approach. Here the message goes with the scrolling as needed but it's not that useable because of side effects.- header/footer view: How do you center here correctly and what about the height?
- a special cell: How do you have a correct height here? What about centering?
I want to use auto layout in my case if possible. Here are my requirements:
- Message (could be also an image with a text) should be centered in the table view.
- If the table view is scrolled, the message should have a fixed position on the table view. It should scroll with the label like it would be label on the scroll view, but the height of the scroll view correlates to the screen height.
- Pull to refresh should be possible.
One example can be seen in the app "app store". If you are in flight mode and you navigate to the tab "updates" you can see this behavior. On iPhone it seems to be a separate cell. Don't know what it is on iPad. Perhaps the same. But how can this be achieved?