I am making UITableView custom cell because height also changed per cell. 

This is my code for initialize cell and after that i want to add UITextView as Subview.

```
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
    let dictAd = self.arrAllQuestions[indexPath.row] as! NSDictionary

    let fontNew = UIFont(name: "AvenirNext-Regular", size: 19.0)
    let strA = "\(indexPath.row+1). \(dictAd.object(forKey: "Title")!)"

    let heightTitle = self.heightForView(text: strA, font: fontNew!, width: tableView.frame.size.width-16)

    return heightTitle+5;
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
    let dictAd = self.arrAllQuestions[indexPath.row] as! NSDictionary

    let cell = tableView.dequeueReusableCell(withIdentifier: "quesionCell", for: indexPath) as! QuestionCell

    let fontNew = UIFont(name: "AvenirNext-Regular", size: 19.0)

    let strA = "\(indexPath.row+1). \(dictAd.object(forKey: "Title")!)"

    cell.lblName.font = fontNew
    cell.lblName.text = strA
    cell.lblName.numberOfLines = 0
    let heightTitle = self.heightForView(text: strA, font: fontNew!, width: tableView.frame.size.width-16)

    var frame = cell.lblName.frame as CGRect
    frame.size.height = heightTitle; //you need to adjust this value
    cell.lblName.frame = frame;

    let txtView = AnimatableTextView(frame: CGRect(x: 8, y: cell.lblName.frame.origin.y+cell.lblName.frame.size.height+5, width: tableView.frame.size.width-16, height: 25))
    txtView.borderWidth = 1.0
    txtView.borderColor = UIColor.lightGray
    txtView.cornerRadius = 4.0
    cell.contentView.addSubview(txtView)

    return cell
}

```

You can see output below.

[![enter image description here](https://i.stack.imgur.com/8arYQ.png)](https://i.stack.imgur.com/8arYQ.png)