Advertisement
RybaSG

FirstVC

Jun 2nd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.74 KB | None | 0 0
  1. import UIKit
  2.  
  3. class FirstViewController: UIViewController {
  4.  
  5.     override func viewDidLoad() {
  6.         super.viewDidLoad()
  7.         // Do any additional setup after loading the view, typically from a nib.
  8.     }
  9.  
  10.     override func didReceiveMemoryWarning() {
  11.         super.didReceiveMemoryWarning()
  12.         // Dispose of any resources that can be recreated.
  13.     }
  14.    
  15.  
  16.     @IBAction func handlePan(_ recognizer:UIPanGestureRecognizer)
  17.     {
  18.         let translation = recognizer.translation(in: self.view)
  19.         if let view = recognizer.view
  20.         {
  21.             view.center = CGPoint(x:view.center.x + translation.x,y:view.center.y + translation.y)
  22.         }
  23.         recognizer.setTranslation(CGPoint.zero, in: self.view)
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement