title: Add child view controller to current view controller
body: <p>I am trying to add a child view controller in code, to the current view controller from storyboard by using the next code:</p>
  
  <pre><code>UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
  LogInTutorialViewController *lvc = [[LogInTutorialViewController alloc] init];
  lvc = (LogInTutorialViewController *)[storyboard instantiateViewControllerWithIdentifier:@"LogInTutorialViewControllerID"];
  [self displayContentController:lvc];
  
  - (void) displayContentController: (LogInTutorialViewController*) content;
  {
  
      //add as childViewController
      [self addChildViewController:content];
      [content didMoveToParentViewController:self];
      [content.view setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
      [self.view addSubview:content.view];
  
  }
  </code></pre>
  
  <p>The view seem to be displaying on the simulator at least but in console I get a lot or error:</p>
  
  <pre><code> &lt;Error&gt;: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
  </code></pre>
  
  <p>And also the same description but different error:</p>
  
  <p>CGContextSetLineWidth, CGContextSetLineJoin, CGContextSetLineCap, CGContextSetMiterLimit, CGContextSetFlatness, CGContextAddPath, CGContextDrawPath, CGContextRestoreGState</p>
  
  <p>all these error get logged twice.  </p>
  
  <p>Does anyone know what I am doing wrong?</p>
  
  <p>also I read a few posts and in some it was suggested to alloc and init the view controller before passing the data, I also tried that without any luck.</p>