Created
March 18, 2019 20:02
-
-
Save ramiresnas/cb0464a817b15405d5ec0e2d02b860ef to your computer and use it in GitHub Desktop.
Move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
guard let touch = touches.first else { | |
return | |
} | |
if let view = touch.view as? UIImageView { | |
selectedView = view | |
} | |
} | |
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) { | |
guard let touch = touches.first else { | |
return | |
} | |
if let view = selectedView { | |
let location = touch.location(in: boxDraw) | |
if boxDraw.bounds.contains(location) { | |
view.layer.position = location | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment