title: Make UITableView cells less wide than the UITableView for large scroll area
body: <p>I would like to achieve the following view layout:</p>
  
  <p><a href="https://i.stack.imgur.com/rkQ6l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rkQ6l.png" alt="View Layout"></a></p>
  
  <p>A <code>UITableView</code> in the middle of my <code>UIViewController</code>'s view. As shown, the rows should <em>not</em> be as wide as the view - <strong>that's easy: just make the table view smaller</strong>, which is what I did for the screenshot.</p>
  
  <p>However, as can be seen in the screenshot, this means that scrolling can only happen in the middle of the view. If a user tries to scroll by dragging on the grey areas left and right of the table view, nothing happens. The UI feels unresponsive.</p>
  
  <p>So: is there a way to have both:</p>
  
  <ul>
  <li>Width of the table view <strong>equal</strong> to width of the enclosing view.</li>
  <li>Width of the cells <strong>smaller</strong> than the width of their table view.</li>
  </ul>
  
  <hr>
  
  <p>I have tried to achieve this by setting the <code>contentInset</code>:</p>
  
  <pre><code>tableView.contentInset = UIEdgeInsetsMake(0, 50, 0, 50)
  </code></pre>
  
  <p>but this just makes <code>contentSize</code> bigger, ie the cells are still as wide as the view but you can now scroll left and right as well.</p>