Part 1: PhotosComplete the guided exercises in Lesson 2.8. Then modify your photo app so that it allows you to view three different photos and their corresponding captions, selected via a segment control. In particular:
For example, your app might look like the screen capture on the right. Your app should look reasonable on different sized devices, meaning that you will have to utilize constraints to position the elements in the screen. For the sake of simplicity, you do not need to worry about how it will appear in landscape mode (i.e., when the device is turned on its side). |
|
Part 2: CalculatorComplete the guided exercises in Lesson 2.10. Then, follow the steps in the Lab at the end of the section to complete the layout of a calculator. This will require you to position a label (for the number value) and 19 buttons (for the digits and operators) using stack views, as described in the Lab. Your app should appear as in the screen capture on the right. Once you have completed the layout, you are to add functionality so that the calculator behaves just like the basic calculator that comes in the Apple Launchpad. Note that this is a non-trivial task, and you will want to tackle it in stages. For example, you might start with being able to enter a sequence of digits and have them appear in the label. Next, be able to reset the number back to 0 by clicking on the Clear button. Then you can move on to handling the operators (which cause a calculation to be performed). To simplify this step, the CalculatorModel class has been provided for you. This class carries out the basic steps of the calculator: entering an operator (along with the displayed number) and getting the current value. You should add this class to your Calculator project and have a Once you have the operators implemented, you can focus on the remaining buttons and the special cases. For example, a number cannot have more than one decimal point - if the user enters more than one decimal point in the same number, all but the first should be ignored. Another special case to worry about is displaying whole numbers. The Note: the elegance of your code is not the main focus here. Later in the course, we will learn techniques that will make tasks such as this one much cleaner and more easily scalable. For now, it is acceptable to have many Outlets and/or redundancy in your code. If you would like hints as to how you can make the code cleaner, be sure to ask. EXTRA CREDIT OPTIONS: For full credit, your calculator can differ from the Apple basic calculator in three ways (described below). For extra credit, you can modify your calculator so that it matches the more complex behavior of the Apple calculator.
|