iOS Development

Course No. 10-152-139

Assignment w14-1

  • Create a new iOS Single View Application project named Assignment-w14-1.

  • In the Main.storyboard change the background color of the view. It doesn’t matter what color you choose as long as it is different than the default.
  • Add two buttons to the View.
    • One near the top with its width expanded to the normal usable full width. Give it the label, “I’ve been tapped 0 time(s)!”.
    • Another one below the first button labelled, “Reset”.
    • Make the buttons’ height a bit bigger and give them a background color that’s a good contrast with the view’s background.

  • Create an IBOutlet for the first button named, “tapCountButton”. Yes, an outlet, you can do that for buttons, too.
  • Create an IBAction for the first button named, “countButtonTapped”.
  • Create an IBAction for the second button named, “resetButtonTapped”.
  • In the ViewController class extension create a property that will hold the number of taps that have been counted. Make the type of the property NSUInteger.
  • When the top button is tapped you need to update the button title with the number of times the button have been tapped. You need to look in the documentation for UIButton to find the method that is used for this. The title is a property, but you need to use a different method to set the title of a button. One hint: UIControlStateNormal.

  • When the Reset button is tapped two things have to happen.
    • The tap counter must be reset to 0.
    • The top button’s title must change back to the original display.

Submitting the Assignment

  • Demonstrate the running app to your instructor in class or prior to class in office hours.
  • Print the XXXViewController.m file and turn it in with the rest of the weeks printed assignments.