UILabel text to fill in the frame width
问题 I want to build typography poster using UILabel left and margin: 25 320(device width) - 50(sum of the margins) = 270(label width frame) The font size of each label should change in order to fit in 270 frame width I try with sizeToFit() , adjustsFontSizeToFitWidth=true var margin = 0; let label = UILabel(frame: CGRectMake(25 , 72, 270, 70)); label.backgroundColor = UIColor.clearColor(); label.textAlignment = NSTextAlignment.Left; label.textColor = UIColor.blackColor(); label.numberOfLines = 1;