Thursday, October 1st — 11:59pm
This project is designed to give you some hands on experience with…
- Using Xcode as a development environment
- Using Interface Builder to create iPhone user interfaces
- Declaring and wiring outlets and actions
- Testing applications in the iPhone Simulator
- Exposure to additional user interface elements
- Using delegates and dataSources for a variety of purposes
For this assignment you will be writing a converter app for the iPhone. Your application must contain the following elements…
- A toolbar containing a centered segmented control that allows the user to choose between 2 or more different categories
- A picker wheel that allows the user to choose between units of conversion (a “from” and a “to”)
- A customized set of buttons that allow the user to specify and edit the “from” value. This set of buttons should include:
- The numbers 0-9
- A decimal point
- A delete (backspace)
- A label that is used to display the “from” and “to” values
When your app initially loads it should look similar to the image shown below:
When a user presses a button, the number should instantly appear in the “from” label under the left wheel (just like a calculator echoes the numbers as you type them). Additionally, the conversions should happen in real-time as the user types. In the example below we see that the number 1 is also immediately displayed as the “to” value under the right wheel. In this case both values are the same, as the “from” and “to” units are the same.
Here the user presses the number 2 which is immediately echoed to the right side of the “form” label to form the number 12. Again, the conversions happen in real-time as soon as the user presses the button. Since both wheels are still the same, we still have 12 on both sides.
If the user spins and releases one of the wheels, immediately upon releasing the wheel, the “to” value should be immediately recalculated and displayed. Here we see that as soon as the left wheel was changed to Kilobytes, the conversion to Bytes immediately happened and the “to” value was updated to the correct value.
A more interesting example of calculations happening in real-time is shown below. As the user presses “.” then “5”, the “to” values are immediately computed and updated.
If the user presses the delete key the values are immediately removed from the right side of the “from” label — one removal for each delete press. Just like when adding digits, when we remove digits from the “from” value, we should perform real-time conversions against the changing value and update the “to” value accordingly.
The following screen simply shows that the “to” value need not be a whole number as shown in the previous screen shots.
If the user selects a different segment in the control at the top of the app, the wheels of the picker should switch over to the appropriate category and contain the corresponding labels. The “from” value should be preserved and conversion should happen immediately upon selecting the new segment.
In the screen shot below, the value has been deleted out and a new value entered. Again, conversions happen as the user manipulates the “from” value.
Below the left wheel has been spun, conversions have automatically happened between the new “from” and “to” units.
A spin of the right wheel. The “to” value is updated immediately after releasing the wheel.
Since we’re providing the input by the way of our own buttons, we know exactly what data can be entered. However, there’s still some error checking to be done. Your app should not allow the user to press the “.” button more than once and end up with a string like “22.214.171.124”.
At a minimum you need to provide options for converting between Data and Temperature.
For Data, you should at a minimum support converting between Byte, Kilobyte, Megabyte and Gigabytes. Yes, I know that my calculations using 210 are now technically called Kibibytes and the like — call me old fashioned. Feel free to follow in my footsteps, or choose to implement it as 103, or use the [KMG]ibibytes notation — your choice.
For Temperature, you should at a minimum support converting between Celsius, Fahrenheit and Kelvin. Wikipedia’s Temperature Conversion Formulas page provides the formulas for these conversions.
Feel free to add additional categories and units if you wish.
The first thing I’d probably do is to print out one of the images of the UI from this assignment and start to think about and identify…
- Where do you need outlets?
- Where do you not need outlets?
- What instance variables you will need?
- What action methods do you need?
- Which of the action methods forms are you using (and thus what’s getting passed in)?
- What interactions call which action methods?
- Will all of the interactions behave as described?
Aside from the documentation for the relevant UI, delegate and dataSource classes, I also found NSDecimalNumber useful in my implementation. You will also want to take a good look at the UIPickerView docs to figure out how to reload the wheel values when switching between categories.
The following items are provided as thoughts as to how you might extend or improve the project beyond the basic requirements. You are not required to implement any of these.
- Try out alternate color combinations — just don’t make my eyes bleed
- Feel free to play with the layout and style of elements — just be sure that things are neatly aligned and that there is at least some justifiable method to your madness
- Add images to the app if you think it will improve the look and feel of the application
- I’m open to using alternate input/display mechanisms — just send me an email to tell me what you’re thinking and I’ll let you know if it is acceptable
Your projects will be graded on the following criteria:
- Correctness of application
- Appearance of application
- Adherence to Objective-C and iPhone coding conventions
- Neatly formatted and indented code
- Well documented header files
- Absence of significant performance issues
- Absence of memory leaks
Like the previous assignment, you are required to submit a zip file of your project directory. Be sure to manually remove the build directory before zipping things up.
To submit the assignment, open up a terminal, navigate to your zip file then issue the command:
submit cs491i assignment3 Assignment3.zip
If developing on your own Mac, you’ll need to transfer the file into your GL account (via SCP), then SSH into GL and issue the submit command.