Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class ViewController: UIViewController {
- @IBOutlet weak var blueView: UIView!
- @IBOutlet weak var greenView: UIView!
- var isBlue = true
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- }
- @IBAction func changeBackgroundColorOnTapped(_ sender: Any) {
- var AquaColor = blueView.backgroundColor
- if isBlue == true {
- blueView.backgroundColor = greenView.backgroundColor
- } else {
- greenView.backgroundColor = UIColor(red: 0/255.0, green: 128/255.0, blue: 255/255.0, alpha: 1)
- }
- isBlue = !isBlue
- }
- @IBAction func didBeginPanGesture(_ sender: UIPanGestureRecognizer) {
- var point = sender.location(in: view)
- blueView.center = CGPoint(x: point.x, y: point.y)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement