Changing text of Swift UILabel

后端 未结 4 1556
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-30 21:51

I am attempting to learn Apple\'s Swift. I was recently trying to build a GUI app, but I have a question:

How do I interact with GUI elements of my app? For instance

4条回答
  •  别那么骄傲
    2020-12-30 22:20

    You may trying to change a UI component not in the main thread, in that case, do this:

    DispatchQueue.main.async {
            someLabel.text = "Whatever text"
    }
    

提交回复
热议问题