在我的故事板中,我有几个图像为“启用了用户交互”。 在UIViewController
我重写touchesEnded
函数。从touches获取图像名称已结束
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event)
}
是否有可能让我得到在这个函数中点击的图像的名称?我宁愿不要@IBOutlet
的图像。
你能解释为什么你不喜欢使用IBOutlet的图像?视图是动态还是布局每次显示都一样? – Stephen
@stephen它是一个堆栈视图中的静态图像和动态图像的混合。 –
检查此答案:https://stackoverflow.com/a/5192999/1718685您应该能够确定触摸下方的视图。 – Stephen