CptS 479 Homework 4 moving the add quotation functionality to a second view….

$30.00

Category: Tags: , , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (5 votes)

This homework builds on HW2 by moving the add quotation functionality to a second view and
using a navigation controller to move between views and manage titles. See screen shots below.
Specifically,
1. First, ensure that your HW4 app has all the required functionality of HW2, except as
changed below. Part of HW4’s grade will be based on proper HW2 functionality.
2. From the main view remove the “Health App” label, “’s Happy Quotes”
label, “Quote:” label and text field, “Author:” label and text field.
3. Embed the main view in a navigation controller. Set the main view’s navigation item
prompt to “Health App” and title to “’s Happy Quotes”
4. Add a Bar Button Item to the right side of the main navigation bar and set it’s System Item
attribute to “Add” (should appear as a “+” sign).
5. Add a new View Controller to the Storyboard. Create a new view controller class for this
view called “AddQuotationViewController” in a new file with the same name.
6. Create a “Show” segue from the “Add” bar button on the main view to the AddQuotation
view. This should create a navigation bar on the AddQuotation view. Set this navigation
bar’s prompt to “Health App” and title to “Add Quotation”. Set the segue’s identifier.
7. Below the navigation bar in the AddQuotation view, add a label that displays “Quotation
#”, where is the number of the next quotation to add, i.e., the number of current
quotations plus one. This information should be passed from the main view to the
AddQuotation view using the prepare for segue on the “Add” button segue.
8. Add the “Quote:” label and text field, and the “Author:” label and text field below the
quotation number label. Be sure to constrain these elements appropriately so that the labels
stay in place even if you type a long quote or author.
9. For all the text field handling that was in the main view controller in HW2, move this
functionality to the AddQuotation view.
10. In the AddQuotation navigation bar, add a Bar Button Item to the left side (overwriting the
Back button) and set its System Item to “Cancel”. Add a Bar Button Item to the right side
2
and set its System Item to “Save”. If the Cancel button is tapped, then the app should use
an unwind segue to return to the main view and no quotation should be added, regardless
of what text was entered in the text fields. If the Save button is tapped, then the app should
use an unwind segue to return to the main view. If there was some text in the Quote text
field, then a new quotation with the appropriate quote and author should be added to the
end of the quotations cycled through with the Next button on the main view. If the Quote
text field was empty, then no quotation should be added, but the app should still return to
the main view.
11. As in the HW2 app, initialize the app with at least three quotations.
12. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
13. Be sure that auto layout constraints are set so that the view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
Storyboard:
3
Simulator: