Resize and move UITableViewCell smoothly without dismissing keyboard

后端 未结 2 1768
情歌与酒
情歌与酒 2021-01-07 07:05

I have got a UITextView inside a UITableViewCell. As the user edits the UITextView text, I resize the UITextView and I need to resize the UITableViewCell and also make sure

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-07 07:18

    hook you constraints properly in cell from top to bottom also don't implement heightForRowAtIndexpath

    then

    in viewDidLoad

    tableView.estimatedRowHeight = 200;
    
    tableView.rowHeight = UITableViewAutomaticDimension;
    

    in data source

      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    
           let cell = tableView.dequeueReusableCell(withIdentifier:CellIdentifier1) as! logTableViewCell
    
           // your code here
    
    
        cell.layoutSubviews()
    
        cell.layoutIfNeeded()
    
        return cell
    
    }
    

提交回复
热议问题