I am trying to justify my text with UILabel , but it does not work.
Declaring my UIView :
descriptionUIView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)
Declaration of my UILabel :
bottleDescriptionLabel = UILabel(frame: CGRect(x: widthMargin, y: bottleDescriptionTitleLabel.frame.maxY + heightMargin, width: self.view.frame.width - (2 * widthMargin), height: heightBottleDescription - (2 * heightMargin))) bottleDescriptionLabel.font = UIFont(name: "AvenirNext-Regular", size: 16) bottleDescriptionLabel.text = bottleDescriptionString bottleDescriptionLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping bottleDescriptionLabel.textAlignment = NSTextAlignment.Justified bottleDescriptionLabel.numberOfLines = 0
And it looks like this:

I don't know what else to use NSTextAlignment.Justified to justify my text. Should I use a UITextView ?
uilabel swift text-alignment justify
magohamoth
source share