Removing image from UIImageView

前端 未结 5 910
清酒与你
清酒与你 2021-02-01 00:44

I load a UIImageView with an image depending on user interaction. When the parent view is initially displayed, no image has been selected and the imageview is blac

5条回答
  •  清酒与你
    2021-02-01 01:14

    I also got the same problem, no matter I use myImageView.image = nil or [myImageView setImage:nil] the image still show on the UIImageView; assuming either one should works. It spend me many hours to debug and find out where have problem. Finally, I did it by using the following code,

            [UIView beginAnimations:nil context:nil];
            [UIView animateWithDuration:1 animations:nil];
            myImageView.image = nil;
            [UIView commitAnimations];
    

    I don't know why, but when I work as an animation then the image can be clear perfectly.

提交回复
热议问题