Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import UIKit
  2.  
  3. class ViewController: UIViewController {
  4.  
  5. var isBlue = true
  6.  
  7. @IBOutlet weak var BlueView: UIView!
  8. @IBOutlet weak var GreenView: UIView!
  9.  
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. }
  13.  
  14. @IBAction func changeBackgroundColorOnTap(_ 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. }
  22. isBlue = !isBlue
  23. }
  24.  
  25.  
  26. @IBAction func PanGest(_ sender: UIPanGestureRecognizer) {
  27. let point = sender.location(in: view)
  28. GreenView.center = CGPoint(x: point.x,y: point.y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement