OGeek|极客世界-中国程序员成长平台

标题: ios - 在 Swift 中将文本添加到 textview [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:56
标题: ios - 在 Swift 中将文本添加到 textview

如何将文本添加到标签或表格 View ,而不是更新标签/表格 View ?

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 = ""
    }
}



Best Answer-推荐答案


thePeople.text = thePeople.text+"NewText"

或更短

thePeople.text += "NewText"

关于ios - 在 Swift 中将文本添加到 textview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26968219/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4