Beginning Tableviews Static Cells

I am following along with the video tutorial Beginning Table Views. In Chapter 29 we create a static cell. However, when I run the project and go to the new tableview, I do not see the static cell - I jsut see lines that represent a tableview. Any suggestions fo what I might have missed? Even after adding the text field to the static cell, that does not appear - there is no place to type content.

Just speculating (i.e. guessing!) here, but take a look at the attributes inspector for your new tableview. Make sure that the Content is set for “Static Cells” and not “Dynamic Prototypes”.

Good luck!

Thanks, rcasey. What I actually found out was that if the table view data source methods in AddItemTableViewController are commented out/deleted, the static cell shows up. A bit of an odd solution. The video does remove these methods (Chapter 27 - Adding a new Screen). I would not have thought this step would have been that important. Seems the presence of those methods tends to make the view look like a tableview, even though static cells were created.

You don’t need those methods for a simple case of a table view using static cells, but they can be useful for situations where you want to change something about the view at runtime, such as hiding or showing the last static cell. What gets displayed will depend on what values you return from those methods, such as how many rows to show. So you do need to remove them if you aren’t using them.

Shorter answer: everything is always more complicated than you think. :slight_smile:

Thanks, sgerrard! Always something new to learn.

This topic was automatically closed after 166 days. New replies are no longer allowed.