Advertisement
Guest User

Untitled

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