The states, counties, and cities are organized into a family tree.
It’s strange that we need two totally different technologies
to navigate the
to move in one direction
(Connecticut → New York → New Jersey)
to move in the other direction
(state → county → city).
Modelis a subclass of
NSObject. For JSOn format, see the weather exercise in Hello.
TableViewControlleris a subclass of
tree.jsonis a text file.
See the last exercise in
for adding a text file (such as
to a project.
The model is a tree in class
of the tree is named “Universe”.
The tree contains sub-trees.
The sub-trees contain of sub-sub-trees,
down to any level.
All of the trees, sub-trees, sub-sub-trees, etc., are called trees.
Each tree is an
The first element of the
giving the name of the tree.
The remaing element(s), if any,
are the subtrees under that tree.
It’s just like programming in the language
The application delegate creates a
which manages a stack of controllers underneath it.
Each controller in this stack
We never uncommented the
method of the view controller.
Model.m. Can you add extra levels: US, Canada and Mexico? The First Ward, the Second Ward in Yonkers?
tree = BEGIN @"Universe", BEGIN @"iPhone Apps INFO1-CE9236 and INFO1-CE9704", BEGIN @"Hello, world" BEGIN @"The Objective-C language" END, BEGIN @"Create an Xcode project" END, BEGIN @"Create a class of objects" END END, BEGIN @"Still-life 2D graphics" BEGIN @"Japan" END, BEGIN @"Manhattan" END BEGIN @"America" END END, BEGIN @"Collections, touches, and animations" END, BEGIN @"Gesture Recognition" END, BEGIN @"Graphics that respond to a touch" END, BEGIN @"Read and write a file" END, BEGIN @"A control and the target/action pattern" END, BEGIN @"View controllers and CADisplayLink animation" END, BEGIN @"View controllers that manage other view controllers" END, BEGIN @"Special types of view controllers" END, BEGIN @"Nib files and the Interface Builder" END, BEGIN @"View classes" END, BEGIN @"UITableView" END, BEGIN @"UIWebView" END, END END;