How do I resolve truncated text issue in Apple Accessibility audit when using Accessibility inspector?
I created a test screen for this example:
class ViewController: UIViewController {
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?
[Re-Titled by Moderator]
Original Title: I have an issue on Apple accessibility audit, the text is truncated but can't see the issue in accessibility inspector app
iPhone 16 Pro