swift异步任务

2024-11-26

必须包裹在DispatchQueue.main.async里面。

必须在开头添加self.

        DispatchQueue.main.async{
            self.cityLabel.text = weather.cityName
            self.temperatureLabel.text = weather.temperaturestring
            self.conditionImageView.image = UIImage(named: weather.conditionName)
        }