如何在标签或tableview中添加文本,而不是更新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 = ""
}
}
答案 0 :(得分:3)
thePeople.text = thePeople.text+"NewText"
或更短
thePeople.text += "NewText"