title: Positioning UIViewControllers in UIScrollView side by side
body: <p>I've got a main View Controller that has a subview of UIScrollView and another 2 UIViewControllers (each with nibs UIView and buttons). The UIViewControllers' UIView are added into UIScrollView using addSubView method. And I'd like to put both UIViewControllers side by side.</p>
  
  <p>I've got the following code but it doesn't seem to work.</p>
  
  <pre><code>[self scrollView].pagingEnabled = YES;
  [self scrollView].contentSize = CGSizeMake(768 * 2, 1024);
  [[self scrollView] setDelegate:self];
  
  CGRect frame1;
  frame1.origin.x = 0;
  frame1.origin.y = 0;
  frame1.size = CGSizeMake(768, 1024);
  
  // Model one
  oneView = [[OneViewController alloc] initWithNibName:@"OneViewController" bundle:nil];
  //oneView.view.frame = frame1;
  [self.scrollView addSubview:oneView.view];
  oneView.view.frame = frame1;
  
  // Model two
  
  CGRect frame2;
  frame2.origin.x = 768;
  frame2.origin.y = 0;
  frame2.size = CGSizeMake(768, 1024);
  
  twoView = [[TwoViewController alloc] initWithNibName:@"TwoViewController" bundle:nil];
  //twoView.view.frame = frame2;
  [self.scrollView addSubview:twoView.view];
  twoView.view.frame = frame2;
  </code></pre>
  
  <p>Why does oneView and twoView inside UIScrollView are in the same place when I've set their frame.origin.x? twoView seems to be on top of oneView where it should be side by side? Any idea where I am doing it wrong? Thanks!</p>
  
  <p><strong>Update</strong>: Here's my full project code on github: <a href="http://bit.ly/PLe1Le" rel="nofollow">http://bit.ly/PLe1Le</a></p>