Sto provando a impostare il testo per adattarlo alle dimensioni di un UILabel
e anche a essere centrato. Lo sto facendo a livello di codice. Questo è ciò che sembra attualmente:Impostazione del testo per adattarsi alle dimensioni di una UILabel e al centro in SWIFT
Come si può vedere, il testo sta andando fuori dallo schermo e non è anche centrato.
Questo è il mio codice:
let questions = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac faucibus tellus."
questionsLabel = UILabel(frame: CGRectMake(10, 10, questionsView.frame.size.width - 20, 80))
questionsLabel.text = questions
questionsLabel.font = UIFont(name: Font.FuturaMedium, size: 25)
questionsLabel.sizeToFit()
questionsLabel.numberOfLines = 0
questionsLabel.textAlignment = NSTextAlignment.Center
questionsView.addSubview(questionsLabel)
Che cosa sto facendo di sbagliato?