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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!