title: Tableview set row height dynamically based on content in swift?
body: <p>I am struck in setting tableview cell row height in swift , On scrolling the row height is changing, please check the screen shot.<a href="https://i.stack.imgur.com/ay91m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ay91m.png" alt="enter image description here"></a></p>
  
  <p>For the first time its scrolling perfect on scrolling multiple times the height is not proper. I am using too many custom tableview cells
  In viewDidLoad
  I added this </p>
  
  <pre><code>self.tableView.rowHeight = UITableViewAutomaticDimension
  </code></pre>
  
  <p>and also added these delegate methods.</p>
  
  <pre><code> func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat
      {
              return UITableViewAutomaticDimension
      }
  
      func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat
      {
          return UITableViewAutomaticDimension
      }
  </code></pre>
  
  <p>Can anyone guide me to achieve this in proper way.</p>