daLizard
daLizard

Reputation: 430

Storyboards and Table View Sections

I've noticed that in Storyboards, when dragging out a Table View object from the Library, you also get a chance to configure table view sections, and bunch of other options. For example, if the content is going to be static cells or dynamic prototypes, etc.

Here's a look at the Table View in Interface Builder (.storyboard file):

Storyboard

and here's how the Table View looks like in a .xib file:

XIB

So my question is - is it possible to configure/style (drag buttons, images, etc. into cells) a table view in a .xib file using Interface Builder or it can only be done programmatically?

Upvotes: 3

Views: 7306

Answers (1)

LJ Wilson
LJ Wilson

Reputation: 14427

Can be done either way. I prefer doing it in IB as the layout is much easier when you can see what you are doing. For dynamic prototypes, you only design a single cell and the contents will be populated in the cellForRowAtIndexPath method. With a Static Cell tableview, you can design the whole thing (many sections and many rows). The requirement for a Static Cell tableview is that the class HAS to be of type UITableViewController, while for Dynamic Prototypes, it can be either a UITableViewController or (my preference for more flexibility) a UIViewController with a UITableView.

Hint - if this is a Static cell tableview and you only design a screen full of sections and rows, be sure to turn off scrolling for the tableview.

Upvotes: 0

Related Questions