Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found that you can simply put that View into the bucket in Xcode, but not in the view controller. (See pic)</p> <p><img src="https://i.stack.imgur.com/1Wav2.png" alt="Not in the view controller"></p> <p>Then, I found that if I made an outlet to that <code>UIView</code>, I could still use it. Note that I had to design the view and make it the proper size, etc either programatically, or in IB before I moved it to this position, since I cannot see it anymore in IB. </p> <p>Then, in the <code>TableViewController</code> class, I used <code>ViewWillAppear</code> to check the count of the array that backs up the TableView. If it was zero, I set the view (using the Outlet) to be hidden or not. </p> <p>Next, I used this code:</p> <pre><code>-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if (noConnectionView.hidden) { return 0; } else { return 480; } } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if (noConnectionView.hidden) { return nil; } else { return noConnectionView; } } </code></pre> <p>This makes it fill my popover, and since the number of cells for section method returns the same count that I already checked (which is zero, if the table is empty) that is the only thing displayed (no empty cells). </p> <p>When there are things to display, <code>ViewWillAppear</code> is called each time (and whenever things are deleted, I call view will appear again) and then the tableView gets rid of the header and it behaves like a normal tableView. </p> <p>This is great because you can use it with a <code>UITableViewController</code> or in sequence with a navigation controller. </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