更新时间:2022-12-09 11:19:20
它需要放置在不同的线程中,以便在线程函数执行完成后立即更新 UI:
It needs to be placed inside a different thread that allows the UI to update as soon as execution of thread function completes:
现代斯威夫特:
DispatchQueue.main.async {
// Update UI
}
Swift 3 之前的旧版本 Swift.
Older versions of Swift, pre Swift 3.
dispatch_async(dispatch_get_main_queue(){
// code here
})
目标-C:
dispatch_async(dispatch_get_main_queue(), ^{
// code here
});