16 Auto Layout: Programmatic Constraints
In this chapter, you are going to interact with Auto Layout in code. Apple recommends that you create and constrain your views in a XIB file whenever possible. However, if your views are created in code, then you will need to constrain them programmatically.
To have a view to work with, you are going to recreate the image view programmatically and then constrain it in the UIViewController method viewDidLoad. This method will be called after the NIB file for BNRDetailViewController’s interface has been loaded.
Recall that in Chapter 6, you overrode loadView to create views programmatically. If you are creating and constraining an entire view hierarchy, then you override loadView. If you ...