Bound Your textview
with cell
from all sides using marginal constraints.(Leading, Trailing, Top and Bottom constraints)
- Disable textView Scrolling
In viewDidLoad() add the following.
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
This will make your cell size according to your textview content size.
Have a look at result :
You don't need to write heightForRowAtIndexPath.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…