Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. @IBOutlet weak var blueView: UIView!
  2.  
  3. @IBOutlet weak var greenView: UIView!
  4.  
  5. var isBlue = true
  6.  
  7. override func viewDidLoad() {
  8. super.viewDidLoad()
  9. // Do any additional setup after loading the view.
  10. }
  11.  
  12. @IBAction func changeBackgroundColorOnTap(_ sender: Any) {
  13. // var aquaColor = blueView.backgroundColor
  14. if isBlue == true {
  15. blueView.backgroundColor = greenView.backgroundColor
  16. }else{
  17. blueView.backgroundColor = UIColor(red: 0/255.0, green: 128/255.0, blue: 255/255.0, alpha: 1)
  18. }
  19. isBlue = !isBlue
  20. }
  21.  
  22. @IBAction func didBeginPanGesture(_ sender: UIPanGestureRecognizer) {
  23. let point = sender.location(in: view)
  24. greenView.center = CGPoint(x: point.x, y: point.y)
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement