Last active
January 2, 2018 17:08
-
-
Save fisherds/f48804988b50fd7608f7 to your computer and use it in GitHub Desktop.
Implementation of our TouchesViewController in the first day demo
This file contains hidden or 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
| import UIKit | |
| class TouchesAndViewsViewController: UIViewController { | |
| @IBOutlet weak var logoImageView: UIImageView! | |
| override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
| if let touch = touches.first { | |
| let position = touch.location(in: view) | |
| print(position) | |
| UIView.beginAnimations(nil, context: nil) | |
| logoImageView.center = position | |
| UIView.commitAnimations() | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment