删除 UIButtons setBackroundImage Monotouch

发布于 2024-09-12 16:59:05 字数 306 浏览 1 评论 0原文

我正在尝试删除已加载到按钮中的图像

button1.SetBackgroundImage(null, UIControlState.Normal);

,但出现错误,因为我无法将其设置为空,这是我可能想到清除它的唯一方法。有人对如何做到这一点有建议吗?

我尝试过执行 FromFile("", Controlstate.Normal),还创建一个 UIImage 并将其设置为 null,然后设置它等。出于某种原因,我可以将 UIImage 的图像设置为 null,但我无法设置按钮上的背景。

谢谢!

I'm trying to remove the images that I've loaded into buttons using

button1.SetBackgroundImage(null, UIControlState.Normal);

and I get an error because I can't set it to null and thats the only way I could possibly think of clearing it. Does anyone have suggestions on how to do this?

I've tried doing a FromFile("", Controlstate.Normal), also creating a UIImage and setting that to null and then setting it etc. For some reason I can set the image of a UIImage to null but I can't set the background on the on the button.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

累赘 2024-09-19 16:59:05

你能不能把按钮换成一个没有背景图像的新按钮?

can you not just swap the button out with a new one with no bg image?

森罗 2024-09-19 16:59:05

创建一个空图像并使用它。

button1.SetBackgroundImage(new UIImage(), UIControlState.Normal);

Create an empty image and use that instead.

button1.SetBackgroundImage(new UIImage(), UIControlState.Normal);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文