title: change width of tableviewcell swift
body: <p>I have a tableView using IB with custom cells and prototype cells.</p>
  
  <p>I'm trying to make the cells a little shorter in width than the tableView.frame to leave a little space between the left and right corners.
  </p>
  
  <pre class="lang-c prettyprint-override"><code>var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as TableViewCell
          cell.bounds = CGRectMake(10, self.tableView.frame.origin.y, 30, self.tableView.frame.size.height)
          cell.layer.bounds = CGRectMake(10, self.tableView.frame.origin.y, 30, self.tableView.frame.size.height)
          cell.textLabel?.bounds = CGRectMake(10, self.tableView.frame.origin.y, 30, self.tableView.frame.size.height)
  </code></pre>
  
  <p><strong>Update:</strong> here is a good example explaining how to add a subView to your tableView.
  <a href="http://natashatherobot.com/ios-frame-vs-bounds-resize-basic-uitableview-cell/" rel="nofollow">http://natashatherobot.com/ios-frame-vs-bounds-resize-basic-uitableview-cell/</a></p>
  
  <p><strong>Update 2:</strong> Looks like there isn't an easy way to do this. There are 3 ways of achieving this as far as I know: </p>
  
  <ol>
  <li>Add a rounded  and a shorter image to your cell that has the same exact color and matches your background.</li>
  <li>You could subclass tableViewCell and then play with the layoutSubviews, this way you can make it shorter before it draws the cell. I've done it but the scrolling performance sucks.</li>
  <li>The best way is to ditch the tableView altogether and re-do it with a collectionView.</li>
  </ol>