Question
Add an @IBAction from the background view to ViewController.swift that responds to Touch Down events. In this method, you will change the background color to
Add an @IBAction from the background view to ViewController.swift that responds to Touch Down events. In this method, you will change the background color to the next color in the sequence. The color sequence should be: black -> white -> light gray -> dark gray -> red -> black. This sequence should repeat indefinitely as the user taps the screen. Use whatever Swift variables, control statements necessary to implement this behavior. To pass the tests, you should use the standard UIColor colors (.black, .white, lightGray, .darkGray and .red)
In ViewController.swift, locate viewDidLoad(). Inside this method, at the bottom, set the background color to .black. This is done so that the first color the user sees on startup is black (our flashlight is conserving battery power :-).
import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started