从UIImageView中删除图像 [英] Removing image from 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;
如何删除图像,使 UIImageView
再次显示为黑色?
upon leaving the view but the image remains. How can I remove the image so the UIImageView
appears black again?
UIImageView
UIImageView
通过IB连接。
推荐答案
将 UIImageView
设为:
myImageView.image = nil
UIImageView
。在调用函数返回时加载图像?是你的 UIImageView
被声明和/或在你的主要函数的其他地方使用吗?
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中删除图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!