Homework 4


Downloads

Finished TabWordList: here

Aim

This homework will get you more familiar with navigation controllers and tab bar controllers.

Task

Make the following changes to TabWordList:

  • Create a total of six tabs. Marvel at what happens.
  • Make a button (UIButton) in the DetailView UI that, when tapped, slides back to the word list — as if you’d tapped the back button in the nav bar. Have a look at UINavigationController for this.
  • Change the back button that appears when you drill down into a DetailView to show the short title (like “Two”) instead of the long default title (like “Increment by two”). This takes three statements in code, but they are a bit hard to understand. See the hints below.
Hints

Eventually I’ll stop bothering to say this: use the documentation.

There is one change you have to make in each of the three classes in the project.

The third task is a little tricky. As we saw, each view controller has a navigation item associated with it that holds information about what appears in the navigation bar when that view controller is visible. The navigation item has a property called backBarButtonItem which represents the back button for the next view controller — that is, the back button that is visible when you’re drilled-down from this one by one level. You’ll have to create a new UIBarButtonItem with the right title (and nil for the target and action, and UIBarButtonItemStyleBordered as the style) and set it as backBarButtonItem. (Where? You figure that out.)

Due

Tuesday February 17, at the beginning of class (6:30PM)

Submission

LabFusion (delete the build directory and zip the project directory)

Solution

Here

Back to the main page