CSC 214
Homework Assignment #2
Due: September 15, 2019 at 11:59 PM
For the second homework assignment you will create an app called CornerColors.
UI Elements:
Your ViewController will hold 4 UIViews
(they can be found in Xcodes UI
element popup and are added like
UILabels, UIButtons, etc.).
Place one in each corner of the main
view. They will be 8080 units in size
and will have an initial background
color of black. Also add a button in the center called Change Colors.
Auto Layout: All UIViews are to be constrained in size and to their respective corners. Views will not move into the arc areas on iPhone X for example but stay in the safe area. The Change Colors button is to be constrained to the center (x, y).
Functionality:
The CornerColors app is based on the Label Changer app from class but operates on UIColor instead of strings. The app will include a ColorManager.swift utility struct and a CornerColors.swift class. Each time the apps center button is tapped all corner views cycle through the colors of a colors array. The latter can be created using dot notation as shown below.
colorsArray = [UIColor.red, UIColor.green,
To facilitate the color change you need outlets for all UIViews. Then assign new colors using your UIViews backgroundColor property in the center buttons IBAction. Use viewDidLoad to set up your corner views so they dont appear black on app start.
UI Testing:
Write a short UI Test when done with 2 main blocks:
The device is to be rotated four times bringing it back to its original orientation. The center button is to be tapped 5 times
This short test will suffice to test all required functionality.
Note: UI testing will be discussed in class on Thursday. It is very easy to implement and will take only a few minutes to set up.
Grading:
You will receive points for:
Project compiles and runs
Project is set up with source control (git)
Center button is correctly positioned with Auto Layout Corner views are correctly positioned with Auto Layout Color cycling functionality works
Corner view colors are updated in in viewDidLoad
UI Tests are functional
Note: The warning below may be ignored for this assignment and in general:
[App] if were in the real pre-commit handler we cant actually add any new fences due to CA restriction.
______________________
As always your homework should be accompanied by a ReadMe file based on the template handed out previously
Reviews
There are no reviews yet.