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