title: UITableViewCell's height is not working
body: <p>Hi I'm trying to implement chat view.</p>
  
  <p>My problem is Autolayout of the stack view is not working...</p>
  
  <p>Updated:</p>
  
  <p>I solved..</p>
  
  <p>//Here is my UITableViewCell.</p>
  
  <pre><code>enum ChatType: Int {
      case Message
      case Photo
  }
  
  class BubbleCell: UITableViewCell {
  
      //Message Bubble
      var bubbleLbl = UILabel()
      var eventLbl = UILabel()
  
      //Photo Bubble
      var paymentView = UIStackView()
      var itemImg = UIImageView()
  
      //Photo Bubble
      var stackView = UIStackView()
  
      //settings
      var owner = Bool()
      var type = String()
      var event = Bool()
  
      //stackMargin
      var topInset: CGFloat = 5.0
      var bottomInset: CGFloat = 5.0
      var leftInset: CGFloat = 0.0
      var rightInset: CGFloat = 0.0
  
      override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
  
          super.init(style: style, reuseIdentifier: reuseIdentifier)
  
  
      }
  
      required init?(coder aDecoder: NSCoder) {
          fatalError("init(coder:) has not been implemented")
      }
  
      func configureCell(owner:Bool, type:ChatType, isLast:Bool) {
  
          self.owner = owner
  
          //set Autolayout
  //        contentView.translatesAutoresizingMaskIntoConstraints = false
          stackView.translatesAutoresizingMaskIntoConstraints = false
          bubbleLbl.translatesAutoresizingMaskIntoConstraints = false
          eventLbl.translatesAutoresizingMaskIntoConstraints = false
          paymentView.translatesAutoresizingMaskIntoConstraints = false
          itemImg.translatesAutoresizingMaskIntoConstraints = false
  
          //set stackView
          stackView.axis = .vertical
          stackView.spacing = 4
          stackView.distribution = .fill
  
  
          bubbleLbl.backgroundColor = .red
  
  
  
          addSubview(stackView)
  
          if owner == true {
  
              leftInset = 90.0
              rightInset = 16.0
              stackView.alignment = .trailing
  
          }else {
  
              leftInset = 16.0
              rightInset = 90.0
              stackView.alignment = .leading
  
          }
  
  
  
          stackView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 20.0).isActive = true
          stackView.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -20.0).isActive = true
          stackView.topAnchor.constraint(equalTo: self.topAnchor, constant: 5.0).isActive = true
          stackView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -5.0).isActive = true
  
  
          switch type {
              case .Message :
  
                  print("Message")
                  stackView.addSubview(bubbleLbl)
  
              case .Photo:
  
                  print("Hellow")
  
  
          }
  
  
          // add updated time to lastCell
          if isLast {
  
              eventLbl.translatesAutoresizingMaskIntoConstraints = false
              stackView.addSubview(eventLbl)
          }
  
          stackView.layoutSubviews()
          stackView.layoutIfNeeded()
  
          layoutIfNeeded()
          layoutSubviews()
  
  
  
      }
  
      override func awakeFromNib() {
          super.awakeFromNib()
          // Initialization code
  
  
  
      }
  
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/v9H9Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v9H9Q.png" alt="enter image description here"></a></p>
  
  <p>And Here is my TableVieController</p>
  
  <pre><code>override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
  
          //define cell
          let bubble = tableView.dequeueReusableCell(withIdentifier: "BubbleCell", for: indexPath) as! BubbleCell
  
          let object = results[indexPath.row]
  
          var checkLastCell = false
  
          if indexPath.row == (results.count - 1) {
  
              checkLastCell = true
  
  
          }
  
          bubble.configureCell(owner: object.isMyBubble!, type: .Message, isLast: checkLastCell)
  
  
          bubble.bubbleLbl.text = object.messageTxt
          bubble.eventLbl.text = object.msgDate
  
  
          bubble.sizeToFit()
  
          return bubble
  
      }
  </code></pre>
  
  <p>As you can see red is UILable and I've set anchor inside the cell but It is not working.</p>
  
  <p>Could you helping me?</p>
  
  <p>Thanks</p>