I want the UILabel text to be larger, but when I change value_row_height, there is no change in size.
var value_row_x = 30
var value_row_y = 100
var value_row_height = 320
var value_row_width = 30
let heart_rate_title_UILabel = UILabel(frame: CGRect(x: value_row_x, y: value_row_y, width: value_row_width, height: value_row_height ))
heart_rate_title_UILabel.center = CGPoint( x: value_row_x + value_row_width / 2, y: value_row_y + value_row_height/2 )
heart_rate_title_UILabel.textAlignment = .left
heart_rate_title_UILabel.text = "heart: "
heart_rate_title_UILabel.sizeToFit()
self.view.addSubview( heart_rate_title_UILabel)
UPDATE:
I added following code, but size failed to change…
heart_rate_title_UILabel.font = label.font.withSize(20)
heart_rate_title_UILabel.minimumScaleFactor = 0.1 //or whatever suits your need
heart_rate_title_UILabel.adjustsFontSizeToFitWidth = true
heart_rate_title_UILabel.lineBreakMode = .byClipping
heart_rate_title_UILabel.numberOfLines = 0
2
Answers
This worked jim-dandy....
You are changing the physical height of the label. You are not saying anything about what the text size should be. Text size is a matter of setting the label’s font (which includes size).