I'm trying to implement a tap gesture recognizer into my app.
Ideally I need for the tap gesture to return the x
and y
coordinates, so I can then create a variable to apply to a core image filter using a parameter which requires the x
and y
values. e.g, the user taps their nose, the gesture recognizer passes the coordinates(a variable, say, nosePosition.x
and nosePosition.y
) into a filter such as CIBumpDistorion
, which need the x
and y
values for its kCIInputCenterKey
.
I have tried using quite a few methods and moving/deleting code all to no avail. So if anyone has some advice I would be very grateful!
Would that work ?
func touch(sender: UITapGestureRecognizer) {
let point = sender.locationInView(self.view)
let x = point.x
let y = point.y
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With