I'm trying to connect a label from my prototype cell of the storyboard to my view controller. Every time I do this I get an error saying "Outlets cannot be connected to repeating content". I don't know why its doing that because I don't where I'm repeating the content but I've provide an image below. Just so you don't get confused the green comments that say "TOP cell: user post" the outlets are connected to the top of the view controller where you see user, message and time. I just want to create outlets from the prototype cell to the view controller without getting this error. I hope this was enough information.
2 Answers
This label belong to UITableView cell. And you connect outlet to Controller so problem happen.
You should do this:
Create a table view cell subclass and set it as the class of the prototype. Add the outlets to that class and connect them.

- 4,277
- 2
- 17
- 30
At run time, there might be zero instances of that cell, or one instance, or 100 instances, depending on how many rows your table view has. Each cell will have its own instance of that label. Which label do you think the outlet should be connected to? There is no good answer.
Anyway, when the view controller is loaded, there are definitely zero instances of the cell, so there is nothing to connect such an outlet to. The cell instances are created later, after the storyboard scene has been fully loaded, by tableView(_:cellForRowAtIndexPath:)
calling dequeueReusableCellWithIdentifier(_:)
repeatedly.

- 375,296
- 67
- 796
- 848
-
Well this error doesn't happen after I run it, it occurs once I connect the label as an outlet on my view controller – JoshyJay Oct 30 '15 at 01:28
-
You get the error while editing the storyboard because Xcode knows at that time that what you're asking is impossible. – rob mayoff Oct 30 '15 at 01:32
-
What you should do is create a custom `UITableViewCell` subclass, set that class as the custom class of your cell and then you can create a link between the label and an outlet in your custom cell class. – Paulw11 Oct 30 '15 at 02:16