Strange error when adding items to prototype cells in storyboard-IB Strange error when adding items to prototype cells in storyboard-IB ios ios

Strange error when adding items to prototype cells in storyboard-IB


In fact you can't just make an outlet from a dynamic cell prototype in the UITableView delegate view controller.

You'll have to subclass UITableViewCell and then attribute this class to your prototype.

Then you can Ctrl-Drag from the Label to the UITableViewCell subclass header file.

Finaly you can access to this outlet in the delegate code after having imported the UITableViewCell header file in it.

This is documented by Apple there at "The Technique for Dynamic Row Content" section.


or you could give the label a tag (e.g. 100) and use

myLabel = [myTableView viewForTag:100];

to get the label


I had the same error myself. Just to add one more potantial root cause for future readers:

In my case I copied a control (a Button in this case) from one prototype cell to the next and the action still referred to the neighbor cell. My table has several different prototype cells.

The fact, that it acutally was a proper subclass of UITableViewCell which was properly connected to the prototype cell made it difficult to actually see the mistake.