Advertisement
Guest User

Untitled

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