【发布时间】:2017-08-30 11:57:58
【问题描述】:
在我的故事板中,我有一些“已启用用户交互”的图像。
在UIViewController 中,我覆盖了touchesEnded 函数。
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event)
}
我可以获取在此功能中单击的图像的名称吗?我不想@IBOutlet 图片。
【问题讨论】:
-
你能解释一下为什么你不喜欢使用 IBOutlet 来处理图像吗?视图是动态的,还是每次显示时的布局都相同?
-
@stephen 它是堆栈视图中静态图像和动态图像的混合。
-
检查这个答案:stackoverflow.com/a/5192999/1718685你应该能够确定触摸下方的视图。
标签: ios swift uiviewcontroller touchesended