从UIImageView中删除图像 [英] Removing image from UIImageView

查看:267
本文介绍了从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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆