title: Where to set a property in UIViewController
body: <p>A rather basic question I'm unsure about. I typically set up my <code>UIViewController</code>'s view-related code in <code>viewDidLoad</code>. If the controller has some properties for labels, etc, this is where I would initialize them and add them to the view. These properties are usually declared in the .m so can be considered pseudo-private.</p>
  
  <p>However - if the controller exposes one of these properties (let's say a <code>UILabel</code>) in its header file, I am finding that I can't rely on it existing when it comes time to set it up. For example:</p>
  
  <pre><code>CustomViewController *controller = [CustomViewController alloc] initWithNibName:nil bundle:nil];
  controller.someLabel.text = @"label text goes here";
  //then comes the presentation code
  </code></pre>
  
  <p>I find that I am setting the label's text too early - <code>viewDidLoad</code> has not fired yet so the label is nil.</p>
  
  <p>Should I create this label in <code>init</code> and add it in <code>viewDidLoad</code>? Should I be doing all my set up in <code>init</code>? Or maybe all the initialization of view properties? Or judge it on a case by case basis?</p>
  
  <p>Or maybe the root cause is that I shouldn't have a controller exposing a view (the label) and use some other pattern?</p>
  
  <p>I'm looking for a consistent way to structure my code.</p>