TableViewCell自適應高度

先設定tableCell高度為自動調整


        NoteTableView.rowHeight = UITableView.automaticDimension;
        NoteTableView.estimatedRowHeight = UITableView.automaticDimension;

在TableViewDataSource 實現 決定Cell高度的方法

高度回傳UITableView.automaticDimension

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableView.automaticDimension
    }