Challenge: Programmatic View Controller
ImageViewController is simple enough that it does not benefit much
from having a XIB file. Create your own ImageViewController which
is purely programmatic. Override loadView() to build the view(s)
that you need and assign the root of that hierarchy to the
view property. Do not call
super.loadView()
, as it will attempt to load
the view hierarchy from a NIB file. As we mentioned at the
beginning of the chapter, loadView() is called
to lazily load the view hierarchy the first time the view property
is accessed.
If you need a hint, see NerdTabViewController in Chapter 31.
Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.