如何对图片进行操作? [英] How can I make an action for a picture?

查看:23
本文介绍了如何对图片进行操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的程序中,我希望用户可以触摸图片以便激活操作.但是,IBAction 函数不能让我把它和图片连接起来.有没有什么方法可以帮助我在用户触摸图片时触发功能?谢谢!

In my program, I want the users could touch a picture so that an action will be activated. However, the function IBAction cannot allow me to connect it with the picture. Is there any method that can help me to trigger a function when the users touch the picture? Thank you!

推荐答案

您可以激活该图片的用户交互,然后检测点击它并根据它们触发操作.但最简单的解决方案是在其后面放置一个按钮,然后将 IBAction 连接到该按钮.这就是我们在这种情况下所做的.

You can activate the User Interaction for that picture, and then detect taps on it and trigger the action based on them. But the simplest solution would be to just put a button behind it, and connect the IBAction to that button. That's what we do in such cases.

这篇关于如何对图片进行操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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