Can't change UIImageView image in function (SWIFT)

前端 未结 2 889
你的背包
你的背包 2021-01-29 14:43

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.

2条回答
  •  青春惊慌失措
    2021-01-29 15:50

    Not sure where you are updating your image either in main thread or background. Don't use sleep, Instead try updating your image in main thread asynchronously with delay.

    DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3))
    { self.GreenImage.image = UIImage }
    

提交回复
热议问题