Removing image from UIImageView

前端 未结 5 1023
清酒与你
清酒与你 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:02

    I had a similar problem with the UIImageView on my UIButton, where I had set the image using

    [button setImage:image forState:UIControlStateNormal];
    

    Setting it to nil would remove the image, but calling the getter again reset the image. I fixed it with:

    [button setImage:nil forState:UIControlStateNormal];
    

    instead of

    [button.imageView.image = nil];
    

提交回复
热议问题