What do I set up in the `init` method versus the `viewDidLoad` method?
cocoa-touch, ios, uiview, uiviewcontroller
Solution
`init` should be used for data related basic initialisation. `viewDidLoad` Should be used for view based initialisation, because the view has been created at that point in time so you can add subviews. There is no point creating subviews if you can't use them yet.
Problem
I'm creating a `UIViewController` subclass, and I create it with a custom init function, `initWithImages:(NSArray *)images`, that then returns the view controller for use. I'm confused however what I'm supposed to do in the `init` versus the `viewDidLoad`, `viewWillAppear`, etc. functions. In this `init` function I set up the image view, a caption label and give it gesture recognizers, but are those things that should only be done when it loads or appears? Should the `init` be as small as possible? What do I put in each is basically my question? I'm using the `UIViewController`s with a `UIPageViewController` so it's important that even with a bunch of view controllers in the page view controller that memory isn't used absurdly, so I want to make sure I'm doing this right.