I am developing a would you rather app and what happens is that some of my questions are too big to fit my label... Is there a way that if there is too much text for the label to fit it will change the size of the label (specifically the height in my case). I've found a couple of answers but:
Add constraints to your label & set number of lines to 0 & line break to Word wrap .
Table View Cell: In the case of tableviewcell
add below lines in your viewdidload
and apply the settings mentioned in the storyboard screenshot.
tableView.estimatedRowHeight = 85.0
tableView.rowHeight = UITableViewAutomaticDimension
只需在UILabel上调用sizeToFit 。
myLabel.sizeToFit()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.