Home > 2010 Winter DPS913 > DPS913 APD601 Lab 3 (due Fri Feb 12)

DPS913 APD601 Lab 3 (due Fri Feb 12)

February 2, 2010 Leave a comment Go to comments

Lab 3 enables you to extend your Lab 2 effort in a few ways. You will make it a tab bar style app, and add tabs to display a list of “buy” transactions, and to reset the app’s data. It is due on Friday February 12.

.

DPS913 APD601 Lab 3 – due Fri Feb 12

Assigned: During Week 4

Due date: Friday, February 12, 2010, at 8:00am

Grade value: 3% of your final course grade

Grading method: The following will be checked:

  • Completeness and adherence to iPhone OS app coding principles
  • Correct interactive operation of the app’s logic
  • Accurate numerical calculations

.

Before you begin

Configure your Xcode environment as described in the “Before you begin” section of Lab 1. This will ensure that your work can be uploaded for grading.

.

Objective(s)

Work with a tab bar style application.

Modify an existing app to work in a tab bar app style.

Persist data / state.

.

Concepts that you will learn

  • Tab bar app style
  • Data persistence
  • Configuring view controllers with properties to expose data (to enable data sharing)
  • Modal view controller (alert)

.

Introduction to the problem that you will solve

The Red Dog Bus Company needs three enhancements to its “BusTickets” app:

  1. Display a list of “buy” transactions
  2. Save and restore its operating state
  3. Enable the user to reset the app’s data back to its initial state

You will create a “BusTicketsV2” iPhone OS app. It will use your Lab 2 view + view controller, but in a tab bar style application – it will be one of the tabs.

Another tab will be used to display a list of “buy” transactions. A third tab will enable the user to reset the app’s data back to its initial first-launch state.

As noted above, the application will save state/data. That is, if the user presses the “Home” button on the device, its current state will be saved. When the app is relaunched, the app’s state (i.e. the number of tickets still available on each bus route, and the list of transactions) will be preserved.

The following images are examples of its user interface (yours may look different):

Lab 3 example, first tab Lab 3 example, second tab

Lab 3 example, third tab Lab 3 example, third tab, with alert

.

Specifications

Create a new iPhone OS app, from the “Window-based Application” template. Name it “BusTicketsV2”.

This will be a tab bar style application. There will be three tabs in your application:

  1. Your existing view + view controller from your BusTickets lab
  2. A view with a UITextView that will (or a UITableView) show a list of transactions
  3. A view with a “reset” button, that uses an alert view to confirm the reset operation

Use Xcode to add existing files to your project – the existing files will be your Lab 2 view and view controller that handled the bus route ticketing functions (three files – .h, .m, and .xib).

The list of “buy” transactions must include:

  • A timestamp
  • Text that identifies the bus route
  • Text that indicates the purchase details

During usage, the application must now survive termination and re-launch, with no loss of data. We suggest that you use simple property list persistence.

For guidance on how to complete this lab, read the next section.

.

Lab 3 guidance

We suggest that you ensure that your BusTicketsViewController still works in this new iPhone OS app, before you go on to make any additional changes.

For the next step, you may want to consider implementing the list of “buy” transactions. As you learned in the lecture, and through the “Tab update” example app, add a string property to one of your view controllers. Then, it can be accessed at the right time by the right view controller.

To persist the data, we suggest saving the required arrays and the “buy” transaction string in a dictionary. Then, you can save the dictionary as a simple and uncomplicated plist.

Dictionary structure:

  • A key-value pair for the array of ticket prices (NSNumber, float)
  • A key-value pair for the array of available seats (NSNumber, int)
  • A key-value pair for the list-of-transactions string

We don’t need to persist the array that is the picker’s data source, because we can rebuild that on demand.

Challenge: Persist the last-viewed bus route. This means adding another key-value pair to the dictionary to hold the segmented control’s selected index, and then using this value when the app launches to programmatically select that segment.

.

Send me your work

Make sure that you have configured your Xcode environment to avoid sending the intermediate build files. This will ensure that your uploads to me are the right size.

Follow these instructions to send me your work:

  1. Make sure your project works correctly
  2. Locate your BusTicketsV2 project folder in Finder
  3. Right-click the folder, and choose Compress “BusTicketsV2”, which creates a zip file
  4. Visit this page: http://matrix.senecac.on.ca/~peter.mcintyre/dps913/, and upload BusTicketsV2
.



Advertisements
Categories: 2010 Winter DPS913
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: