2010-12-24 11 views
0

Was mache ich hier falsch? Ich bekomme nicht den RandomNum-Wert angezeigt, wenn ich im Simulator laufe. (Ich habe bereits alles in IB verknüpft). (Edit: Eigentlich stürzt das Programm gerade jetzt) ​​Random Num in einem Label-iPhone

.m file: 

randomNum=arc4random() % 100; 
randomNumLabel.text=randomNum; 

.h file: 
int randomNum; 
int guess; 
IBOutlet UITextField *numberField; 
IBOutlet UILabel *randomNumLabel; 

Antwort

2

Sie müssen die Zahl in einen String konvertieren, indem Sie NSString ‚s stringWithFormat: Methode.

randomNumLabel.text = [NSString stringWithFormat:@"%i", randomNum];