Working with Object Graphs in Storyboarding - dummies

Working with Object Graphs in Storyboarding

By Neal Goldstein, Dave Wilson

You can use storyboarding to begin your iOS application development in Xcode4. As you create your storyboard, you create an object graph that is then archived when you save the file. When you load the file, the object graph is unarchived.

So, what’s an object graph? Here’s the short answer: Object-oriented programs are made up of complex webs of interrelated objects. They are linked to one another in a variety of ways. One object can contain another object, for example, or it can own it, or it can reference it.

All the items that you see in your storyboard (and some items that you don’t see) are all objects and are part of that web of objects. The Interface Builder editor allows you to create this network graphically and then, at runtime, it makes the connections for you.

A storyboard file can capture your entire user interface in one place and lets you define both the individual view controllers and the transitions between those view controllers. As a result, storyboards capture the flow of your overall user interface in addition to the content you present.

If you are creating new applications, the Xcode templates have an option for you to use storyboards. For other applications, you can add storyboards, but you won’t often need to.

In the application you build, you use just one storyboard file to store all the view controllers and views for each device. Behind the curtain, however, Interface Builder takes the contents of this one storyboard file and divides it into discrete pieces that can be loaded individually for better performance.

For you to truly get a feel for the essence of the storyboard, however, you need to see how the storyboard replicates the way an iOS application is structured — in other words, you need an in-depth look at the iOS application architecture. The best way to do that is within the context of a real application.