Multiline UILabel in StackView

I have the following cell content in UITableViewCell:


Button - Label 1 - Label 2 - Accessory (Disclousre inidcator)


I stack "Button and Label 1 together). The Button is set as fixed width.


The constraints are as folows:

Leading + 15 -> StackView (spacing 15) -> Label 2 + 15 -> Superview = 0


I have added the following code:

- cell.label1.lineBreakMode = .byWordWrapping

- cell.label1.numberOfLines = 0


The result is the content show in 3 line but cutoff from the top and bottom. (I believe it is vertial center in the cell).


I added the following but has no effect at all:

- tableView.estimatedRowHeight = 60

- tableView.rowHeight = UITableViewAutomaticDimension


I also add the following constraint to StackView and Label but has no effect at all:

height >= 34


Please advise.

>I have added the following code:

>- cell.label1.lineBreakMode


UILineBreakMode was deprecated a while back:


https://developer.apple.com/documentation/uikit/uilinebreakmode?language=objc

Multiline UILabel in StackView
 
 
Q