I have a UIImageView
that the user can drag around. I want something to happen when it hits (gets dragged over) certain points on the screen (all the points from x: 0 y: 0
to x: 0 y: 100
).
This is the code I currently use:
@IBOutlet var imageView: UIImageView!
var location = CGPoint(x: 0, y: 0)
override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {
var touch : UITouch! = touches.first as! UITouch
location = touch.locationInView(self.view)
imageView.center = location
}
func pointDetection() {
if location == CGPoint(x: 0, y: 100) {
println("1 Point!")
} else {
println("0 Points")
}
}