从 UIImageView 中删除图像

Removing image from UIImageView(从 UIImageView 中删除图像)

本文介绍了从 UIImageView 中删除图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 black. If the user leaves that view and comes back, the image is still there. I've tried

myImageView.image = nil;

upon leaving the view but the image remains. How can I remove the image so the UIImageView appears black again?

The

UIImageView

is connected through IB.

解决方案

Setting the UIImageView as:

myImageView.image = nil 

is the correct way to clear an UIImageView. Are you loading the image when your calling function returns? Is your UIImageView being declared, and/or used elsewhere in your main function?

这篇关于从 UIImageView 中删除图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:从 UIImageView 中删除图像

基础教程推荐