1

I am creating an iOS app that has a form to create a certain 'event'. This form is wrapped in a tableview. This tableview consists of static cells. But there is one section in the table that can be used to add persons to this event and thus on a button press a new tableview cell needs to be inserted at that section. To demonstrate this see the following image:

enter image description here

What I want to know is how to insert cells into a static table. And also how to grab them when the user submits the form, since, as far as I'm concerned, you can't grab a specific section of a table.

I already looked at this kind of concept but this does not apply on adding cells:

Mixing static and dynamic sections in a grouped table view

Thanks,

Community
  • 1
  • 1
Sjaak Rusma
  • 1,424
  • 3
  • 23
  • 36

2 Answers2

2

I think there are (at least) 2 workarounds for this:

  1. You could add a dynamic UITableView as a child to the UITableViewCell. See this stack overflow question about this.
  2. An other solution would be to bypass the table functionality in that cell and change the height of the cell and add the extra controls manually.
Community
  • 1
  • 1
Edwin Vermeer
  • 13,017
  • 2
  • 34
  • 58
1

It's not possible to add or remove cells at runtime, you'll need to use a data source for your tableview. I asked a similar question here, with no luck.

In response to your second question, you can always grab cells using the cellForRowAtIndexPath: method on UITableView.

Community
  • 1
  • 1
Robert Karl
  • 7,598
  • 6
  • 38
  • 61
  • Sad enough this is the correct answer. I am going to use one cell and make that cell higher each time a person is added. – Sjaak Rusma May 02 '14 at 09:09