简体   繁体   English

当用户触摸图像时如何显示图像,而当用户不再触摸图像时又如何隐藏图像?

[英]How do you display an image when the user touches it and is hidden again when they are not longer touching it?

我正在创建一个应用程序,但我找不到有关如何仅在用户将鼠标悬停在文本框上时显示图像属性以及在用户不再触摸它时再次隐藏该图像属性的任何信息。

There are several ways of doing this. 有几种方法可以做到这一点。 I'll give one possibility: 我将给出一种可能性:

You can use a button and add 2 actions, one for 您可以使用一个按钮并添加2个操作,一个用于

UIControlEventTouchDown UIControlEventTouchDown

and one for 还有一个

UIControlEventTouchUpInside | UIControlEventTouchUpInside | UIControlEventTouchUpOutside UIControlEventTouchUpOutside

in the first one you show the image and in the second one you hide the image 在第一个中,您显示图像,在第二个中,您隐藏图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM