O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required