Comment pouvez-vous ajouter une nouvelle ligne dans une swift étiquette.texte
Je fais une application et je veux ajouter une nouvelle ligne, dans un Enseigner.texte
func RandomQuestions(){
var RandomNumber = arc4random() % 1
RandomNumber += 1
switch(RandomNumber){
case 1:
QuestionLbl.hidden = false
QuestionLbl.text = "2x + 4 = 14"
Button1.setTitle("x = 5", forState: UIControlState.Normal)
Button2.setTitle("x = 4", forState: UIControlState.Normal)
Button3.setTitle("x = 9", forState: UIControlState.Normal)
Button4.setTitle("y = 5", forState: UIControlState.Normal)
Teach.text = "2x + 4 = 14"
CorrectAnswer = "1"
break
default:
break
}
}
Donc, en d'autres mots, j'ai besoin d'ajouter une autre ligne, de sorte que lorsque je suis en train de tester mon application, le 'Enseigner' faut dire
2x + 4 = 14
2x = 10
- est-il un UILabel?
Vous devez vous connecter pour publier un commentaire.
Si c'est un UILabel, ensemble numberOfLines champ à 0
Et assurez-vous qu'il est assez grand pour afficher à la fois les lignes.
Il suffit d'ajouter le code suivant
Espère que ça aide