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 BlueView: UIView!
- @IBOutlet weak var GreenView: UIView!
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- @IBAction func changeBackgroundColorOnTap(_ sender: Any) {
- var 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 PanGest(_ 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