Get values from a textfield array

前端 未结 4 480
难免孤独
难免孤独 2021-01-29 10:07

I would like to access the values of my textfield array but confused as the array I created is with tags. So anyone knows how to get the value of the list (array) I created?

4条回答
  •  被撕碎了的回忆
    2021-01-29 10:31

    Create an outlet connection and connect all your textfields to the same.

    An outlet connection looks like

    @IBOutlet strong var labels: [UILabel]!
    

    Then to get all textfield contents and to append the same.

    var resultString = ""
    for item in enumerate(self.labels) {
       resultString = resultString + item.text
    }
    

提交回复
热议问题