3

How do i add text to a label or tableview, instead of updating the label/tableview?

var personArray: [Person] = [
Person(name: "Heine", sex: "Guy"),
Person(name: "Magnus", sex: "Girl"),
Person(name: "Sarah", sex: "Girl")
]

@IBOutlet weak var thePeople: UILabel!

func updatePeople()
{
    for peop in personArray{
        thePeople.text = ""
    }
}
3
  • you can use stringByAppendingString or stringWithFormat to append string Commented Nov 17, 2014 at 8:19
  • What are you trying to do exactly? Add text without updating? Do you want to append? Commented Nov 17, 2014 at 8:19
  • uh, the question is about a "textview", and the code is about UILabel? Commented Apr 6, 2023 at 6:10

1 Answer 1

5
thePeople.text = thePeople.text+"NewText"

or shorter

thePeople.text += "NewText"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.