title: Centering and scrolling UIScrollView content with dimensions both larger and smaller
body: <p>How do you handle centering and scrolling content in a <strong>UIScrollView</strong> when the dimensions are both larger and smaller than the containing scroll view?</p>
  
  <p>I have been trying to set values in <strong>layoutSubviews</strong> to handle the initial centering of the content, while still allowing for scrolling.</p>
  
  <p>If the content is smaller in both dimensions, I can just set the <strong>frame</strong> and the image is properly centered for all rotations and orientations. Setting the <strong>contentInset</strong> will also work. <strong>contentOffset</strong> does not seem to work.</p>
  
  <p>If the content is larger in both dimensions, I can set <strong>contentOffset</strong> for the initial display, and not modify it again to support scrolling.</p>
  
  <p>What do I do if I have an image with one dimension larger, and the other smaller, than the scroll view?</p>
  
  <p><strong>contentOffset</strong> uses a <strong>CGPoint</strong>, and <strong>contentInset</strong> uses <strong>UIEdgeInsets</strong> (top, left, bottom, right). I have tried mixing positive and negative, since one dimension needs to be moved in and the other out, but haven't gotten anything to work.</p>
  
  <p>My next thought is to resize the scroll view (and modify constraints I suppose) so that the content is never smaller than the container and use <strong>contentOffset</strong>.</p>
  
  <p>I would really like to have a single approach that will work regardless of larger or smaller dimensions.</p>
  
  <p>What is the best solution (a solution) to this problem?</p>