Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I display a placeholder image when my UITableView has no data yet?
    text
    copied!<p>I have an application that, on load, displays a UITableView with the user's data in it. </p> <p>However, when the user <em>first</em> loads the application (before they've created any data), I'd like to display, instead of an empty table, a background image (with an arrow pointing to the 'add a record' navbar button). Once the user has added their first record, the tableview is displayed instead. I've seen numerous apps do this - the only example I can think of at present is Cha-Ching, before you have any budgets/etc set up. I can't for the life of me work out how to do this, though.</p> <p>I initially added a navigationcontroller to the main window's xib, the rootViewController of which was a custom viewcontroller/xib. This rootViewController contained the background image with a hidden tableview above it, and a custom tableviewcontroller that managed the tableview. This seemed to work just fine, and if there was data it would load and display in the table. However, if I was to scroll the data offscreen, the app would crash, with this error:</p> <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITextEffectsWindow tableView:cellForRowAtIndexPath:]: unrecognized selector sent to instance 0xd2d130' </code></pre> <p>I have no clue what a UITextEffectsWindow is, or why it was trying to manage my tableview. I presume something may be hooked up incorrectly in my view hierarchy...</p> <p>If there's a much simpler/more straightforward way of doing this, I'd be very grateful if someone could explain it. How would you do this?</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload