How can I fix the truncated text issue reported by the Apple Accessibility Inspector? I created a sample view controller with the system font set to its maximum size, and the label appears to be truncated.
private let testLabel: UILabel = {
let label = UILabel()
label.text = "Apple A11y Tes"
label.textAlignment = .center
label.numberOfLines = 1
label.adjustsFontForContentSizeCategory = true
label.font = .preferredFont(forTextStyle: .headline)
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
private func setupUI() {
view.addSubview(testLabel)
NSLayoutConstraint.activate([
testLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
testLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor),
testLabel.leadingAnchor.constraint(greaterThanOrEqualTo: view.leadingAnchor, constant: 25),
testLabel.trailingAnchor.constraint(lessThanOrEqualTo: view.trailingAnchor, constant: -25)
])
}
}
What is the expected result here?