I try to get the coordinates from the location where I hit the touchscreen to do put a specific UIImage at this point.
How can I do this?
I try to get the coordinates from the location where I hit the touchscreen to do put a specific UIImage at this point.
How can I do this?
Swift 4.0
source
This is work in Swift 2.0
Taking this forward for Swift 3 - I'm using:
Happy to hear any clearer or more elegant ways to produce the same result
In a
UIResponder
subclass, such asUIView
:This will return a
CGPoint
in view coordinates.Updated with Swift 3 syntax
Updated with Swift 4 syntax