title: UIScrollView in UIPopoverController
body: <p>I am struggling to enable zooming in a <code>UIPopoverController</code> using a <code>UIScrollView</code>. The scrollView is 600x600 and it should display a view controller that displays a <code>UIImageView</code>. The image appears except it's not centered.</p>
  
  <p>This is the code from the <code>viewDidLoad</code> method in the view controller that is displayed in the popover.</p>
  
  <pre><code>- (void)viewDidLoad {
      self.imageView = [[UIImageView alloc] init];
      self.imageView.contentMode = UIViewContentModeScaleAspectFit;
      self.imageView.image = self.image;
  
      self.scrollView = [[UIScrollView alloc] init];
      self.scrollView.backgroundColor = [UIColor greenColor];
      [self.scrollView setContentSize:self.imageView.image.size];
      [self.scrollView setDelegate:self];
  
      [self.imageView setFrame:CGRectMake(0, 0, 600, 600)];
      self.view = self.scrollView;
      [self.scrollView addSubview:self.imageView];
      // Do any additional setup after loading the view.
  }
  </code></pre>
  
  <p>The <code>UIScrollView</code> and <code>UIImageView</code> are declared as properties inside the <code>UIViewController</code> that's displayed in the popover. <code>image</code> is another property that is set to point to an image when the <code>UIViewController</code> is created.</p>
  
  <p>This is what is looks like.</p>
  
  <p><a href="https://i.stack.imgur.com/ljRcQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ljRcQ.png" alt="enter image description here"></a></p>
  
  <p>I would like to center the image in the popover and make it fit. How can I do that? Thanks.</p>