我希望能够确定用户在Swift中单击UIImageView的x,y位置。
答案 0 :(得分:0)
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if let touch = touches.first {
let position = touch.location(in: imageView)
print(position.x)
print(position.y)
}
}