ios - How to make random number from int to string -
i using swift make math question app made generator random number when run doesn't work. want random number show in label.
my code was:
var randomnumber = arc4random() % 10 randomnumber = questionlabel.text how code converted string format. thanks
it looks trying assign text of label random number. wrong way around. need convert number string, can in swift using string interpolation:
var randomnumber = arc4random() % 10 questionlabel.text = "\(randomnumber)" as side note questionlabel shouldn't have uppercase q not refer class.
Comments
Post a Comment