Guest User

Untitled

a guest
Aug 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. @IBOutlet var testLabels: [UILabel]!
  2. @IBAction func handlePan(recognizer:UIPanGestureRecognizer) {
  3. var touchedPoint: CGPoint!
  4. if let view = recognizer.view{
  5. if recognizer.state == .began || recognizer.state == .changed {
  6. touchedPoint = recognizer.location(in: view)
  7. for index in testLabels.indices {
  8.  
  9. if testLabels[index].frame.contains(touchedPoint) {
  10.  
  11. testLabels[index].backgroundColor = UIColor.blue
  12.  
  13. }
  14. }
  15. }
  16. if recognizer.state == .ended {
  17. for index in testLabels.indices {
  18.  
  19. testLabels[index].backgroundColor = UIColor.white
  20.  
  21. }
  22. }
  23. }
Add Comment
Please, Sign In to add comment