iOS Development

Course No. 10-152-139

Assignment 27-1

  • Create a new Xcode command-line project. Name the project Assignment-27-1.
  • Write a program that will display the time while it is running.
  • You might want to review the challenge for chapter 10 for help with this project.
  • When the minute changes the program will display the hour:minute:second like this:
  • In between the minute changes the program will output a visual display that will indicate every second and every ten seconds. Something like this:
  • After the program has been running for several minutes its output would look something like this:
    • Note that when the program starts it will most likely have a partial line of seconds before the first minute is displayed.

Project Classes

  • The program will need two classes, one for the minute display and one for the second display.
  • The class for the minute display will have these features.
    • A public method that has no return and one parameter that is a pointer to an NSTimer.
    • This method will output the minute when the minute changes.
  • The class for the second display will have these features.
    • A public method that has no return and one parameter that is a pointer to an NSTimer.
    • This method will output a character when the value for the current second has changed. If the second is divisible by 10 then output a different character.

In the main function

  • Instantiate one object from each of the above two classes.
  • Create two NSTimer instances.
  • The first NSTimer will have its target be the minute tracking class. It must have a time interval of 0.5 seconds.
  • The second NSTimer will have the seconds tracking class as its target. It must have a time interval of 0.1 seconds.
  • Access the current NSRunLoop and run it.