Answer the question
In order to leave comments, you need to log in
How to collect data from all TextField?
Good day everyone!
Problem essence following:
There is a table with a cell in cells 2 TextField. The user himself creates the number of cells by clicking on the Add button (a new cell appears in the table with text fields) and so the number of cells can be N. Also in the table itself there is a Create button (it is always right below the cells) as by clicking on Create Take away all the data that the user entered and, for example, save them to an array.
an array of type let array = [String]() where 0 index in the array is the data from the cell at index 0, etc.
I don’t quite understand how to pick up data, I tried to fly an instance of the cell class in the table class and pick up data through it from the text fields, but it comes nil.
Thanks for the tips
Here's what it looks like
g.recordit.co/KTulGfnWjU.gif
Answer the question
In order to leave comments, you need to log in
First, you can simply put IBOutlets next to the cell, i.e.
@IBOutlet var textFiled1: UITextFiled!
@IBOutlet var textFiled2: UITextFiled!
@IBAction func buttonTapped(sender: Any) {
var text1 = textField1.text
array.append(text1) // если нужно добавить в массив
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question