Changing UILabel text has delay, but why?

后端 未结 2 1994
囚心锁ツ
囚心锁ツ 2021-01-22 15:08

in my app I want to set the text of an UILabel. The text comes from a JSON-object. I add my UILabel to my storyboard, set the IBOutlet and

2条回答
  •  孤独总比滥情好
    2021-01-22 15:48

    c_rath's answer is correct. In swift 3 the syntax was changed (yet again) to

    DispatchQueue.main.async {
        self. label_news?.text = resp.NewsText
    }
    

提交回复
热议问题