Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @IBOutlet var testLabels: [UILabel]!
- @IBAction func handlePan(recognizer:UIPanGestureRecognizer) {
- var touchedPoint: CGPoint!
- if let view = recognizer.view{
- if recognizer.state == .began || recognizer.state == .changed {
- touchedPoint = recognizer.location(in: view)
- for index in testLabels.indices {
- if testLabels[index].frame.contains(touchedPoint) {
- testLabels[index].backgroundColor = UIColor.blue
- }
- }
- }
- if recognizer.state == .ended {
- for index in testLabels.indices {
- testLabels[index].backgroundColor = UIColor.white
- }
- }
- }
Add Comment
Please, Sign In to add comment