Can't change UIImageView image in function (SWIFT)
问题 I have called this function after it is declared and everything works but the UIImageViews don't change their image. I would be very grateful for your help. 回答1: I think that the problem is the sleep(3), this line block the main thread. Instead of that use: DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { // your code here } Apple Reference Note: For the most part, use UIKit classes only from your app’s main thread. This is particularly true for classes derived from UIResponder or that