Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class FirstViewController: UIViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- @IBAction func handlePan(_ recognizer:UIPanGestureRecognizer)
- {
- let translation = recognizer.translation(in: self.view)
- if let view = recognizer.view
- {
- view.center = CGPoint(x:view.center.x + translation.x,y:view.center.y + translation.y)
- }
- recognizer.setTranslation(CGPoint.zero, in: self.view)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement