CSC 581: Mobile App Development
Spring 2019

HW1: Flashlight & Decision Maker


Part 1: Flashlight

Complete the guided project at the end of Unit 1, which develops a simple flashlight app. Your app should initially display a white screen (the flashlight turned on) and should toggle between white and black backgrounds at the touch of the screen. In addition, you should add a label, centered at the bottom of the screen, which displays instructions. If the flashlight is on, the label should display "Touch screen to turn off" in black text. Likewise, if the flashlight is off, the label should display "Touch screen to turn on" in white text. You should use auto layout constraints to ensure that the app looks reasonable on different devices and orientations.

   

Part 2: Executive Decision Maker

Building upon what you learned in Unit 1, design and build an app that serves as a simple Executive Decision Maker. The app should instruct the user to think of a yes/no question, then display a random answer (either YES, NO, or MAYBE) at the click of a button. Initially, the app should look as on the left (with a light gray background and white text). A title with your name should be centered and near the top of the screen. Instructions and a button should appear at the center of the screen, and an empty label for answers should be centered and below that button. When the user clicks on the button, the random answer should appear in the label, in red all-caps text, as shown on the right.

   

Since this is still a simple app, you may forego creating a separate Swift class to serve as the Model for the project. Instead, you may place the logic for generating a random number and selecting between the three answers directly in the ViewController method that responds to the button click. As before, you should use auto layout constraints to ensure that the app looks reasonable on different devices and orientations.