UIImageView image does not update visibly when image property is set

后端 未结 1 341
萌比男神i
萌比男神i 2021-01-20 02:05

I have a UIImageView whose user interaction is true and to which I have given a tap gesture recognizer, whose action handler is as follows:

@IBAction func ta         


        
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-20 02:40

    This seems to be a workaround:

    iv.image = im2
    delay(0.05) {
        iv.image = nil
        iv.image = im2
    }
    

    But what a horror... Omitting any of those assignments, or reducing the delay to zero (e.g. by calling DispatchQueue.main.async instead), causes the workaround to fail.

    0 讨论(0)
提交回复
热议问题