0

Can anyone please lay out clearly how to do this?? I have not found one clear step by step of how to do this. I'd like to drag the table view and it's elements inside the storyboard cell and then do the rest programmatically using swift.

I know, I know, It's not recommended. I plan on making the internal table view expand to display all options and remove scrollable. I just need a way to list a variable amount of options inside a table view cell (creating elements isn't working for me)

Thanks for the help!

Jonah Elbaz
  • 315
  • 7
  • 14

1 Answers1

0

First things first.. Why is creating elements not working? cant you simply use heightForRowAtIndex and resize the cell to fit components?

Anyway, the way you do this is to add a UITableView inside the UITableViewCell, and subclass the UITableViewCell to implement UITableViewDelegate / UITableViewDataSource.

Inside your custom UITableViewCell class you need to create an outlet to point to the UITableView you added previously in the cell.

On IB select the cell, assign the class, and connect the outlets of that class to the cell prototype.

Jose Quintero
  • 181
  • 1
  • 4
  • My question to find out why it's not working: https://stackoverflow.com/questions/47426952/create-a-variable-sized-list-within-a-table-view – Jonah Elbaz Nov 22 '17 at 16:02
  • I'll try and follow your steps when I get home tonight but off what I'm reading I feel like I dont have enough to implement. What does it mean to subclass? I'm subclassing the TableViewCell I'm embedding the table view inside? Then implement the Delegate/Datasource on that subclass by having the subclass extend it? I dont get the last line at all "On IB select the cell, assign the class, and connect the outlets of that class to the cell prototype." – Jonah Elbaz Nov 22 '17 at 16:04
  • Btw, my confusion is my fault for not understanding, just trying to pick your brain a little more ;p – Jonah Elbaz Nov 22 '17 at 16:05