title: Do I programmatically add SubViews in ViewDidAppear, ViewDidLoad, ViewWillAppear, the constructor?
body: <p>I'm trying to figure out from Apple's <a href="https://developer.apple.com/reference/uikit/uiviewcontroller" rel="nofollow noreferrer">sketchy</a> documentation which method is the best place to be initializing and adding my Views controls to the controller's view.</p>
  
  <p>With winforms it's fairly straightforward, as they're always initialized inside <code>InitializeDesigner</code>, called in the constructor. I'm trying to match the reliability of this pattern if possible.</p>
  
  <p>I'm working with <code>UIViewControllers</code> and <code>UITableViewControllers</code> inside a <code>UINavigationController</code> most of the time - if this effects it all.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>public MyController()
  {
      // Here?
      AddViews();
  }
  
  public override ViewDidLoad()
  {
      base.ViewDidLoad();
  
      // Or is should it be here?
      AddViews();
  }
  
  public override ViewWillAppear(bool )
  {
      base.ViewWillAppear(animated);
  
      // Here?
      AddViews();
  }
  
  public override ViewDidAppear(bool animated)
  {
      base.ViewDidLoad(animated);
  
      // Or maybe here?
      AddViews();
  }
  
  void AddViews()
  {
      UILabel label = new UILabel();
      label.Text = "Test";
      label.Frame = new RectangleF(100,100,100,26);
      View.AddSubView(label);
  
      UIWebView webview = new UIWebView();
      webview .Frame = new RectangleF(100,100,100,26);
      View.AddSubView(webview);
  }
  </code></pre>
  
  <p>I get mixed results with some UIControls when I add them to the view in different places. Visual lag sometimes, othertimes the webview is hidden somewhere. </p>
  
  <p>Is there a general rule to keep to for adding them?</p>