I am creating a view controller that holds a couple different fields for creating a log entry. To do this I have used a grouped table view with static cells, which looks like this:
Within each cell I have added a textfield (which has placeholder text as you can see from the screenshot). For the first text field I was able to create an IBOutlet for it using a subclass of UITableViewCell that I created, as seen below:
public class TextInputTableViewCell: UITableViewCell{
@IBOutlet weak var textField: UITextField!
}
However, when I tried to do the same for the second cell, using the following class:
public class MultipleTextInputTableViewCell: UITableViewCell {
}
It doesn't let me use-control click, or frankly any other method, to create an outlet for the text fields. I have tried setting the cell as a member of "MultipleTextInputTableViewCell" in the identity inspector, but that did not solve the problem. I have compared the two situations very closely and found no differences, so I am really confused to as why it isn't working for the second cell.
EDIT:
I was asked to post the attributes for the cell from the identity inspector. Below is a screenshot:
So I solved my own answer, but Stack Overflow won't let me accept it for another two days.
From what I can tell, this is an Xcode bug.
By manually typing out each outlet and then dragging the connection circle in the line-counter to each text field I was able to connect them. However, I tried it the other way around (option-click dragging from a text field to the written code) and that still didn't work. I am using assistant editor capability to do this so the issue may lie there.
EDIT:
Also, what actually would have been the accepted answer from me that I just found out (a couple hours later after I posted this question) is that you can create an @IBOutlet directly in the view controller holding the table view if you are using static cells. There is no need to create subclasses for each cell, and I guess Xcode is discouraging it through not allowing it to be easily connected. This connection works both ways and greatly simplifies my project. But kudos to myself I guess.