title: How can I set UITableView cell height programmatically in Swift?
body: <p>How to set view height programmatically? I have this code:</p>
  <pre><code>cell.viewMain.frame = CGRectMake(cell.viewMain.frame.origin.x, cell.viewMain.frame.origin.y, cell.viewMain.frame.size.width, 65.0)
  </code></pre>
  <p>But that is not working.</p>
  <p>UPDATE:</p>
  <pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCellWithIdentifier(&quot;updateCell&quot;, forIndexPath: indexPath) as! UpdateCell
      
      if self.data[indexPath.row] == &quot;b&quot; {
          tbUpdate.rowHeight = 85
          cell.viewMain.frame = CGRectMake(cell.viewMain.frame.origin.x, cell.viewMain.frame.origin.y, cell.viewMain.frame.size.width, 65.0)
      }else{
          tbUpdate.rowHeight = 220
          cell.viewMain.frame = CGRectMake(cell.viewMain.frame.origin.x, cell.viewMain.frame.origin.y, cell.viewMain.frame.size.width, 200.0)
      }
      
      return cell
  }
  </code></pre>