Reputation: 32071
What am I doing wrong here? I'm not getting the randomNum value displayed when I run in simulator.. (I've already linked everything in IB). (Edit: Actually the program just crashes now)
.m file:
randomNum=arc4random() % 100;
randomNumLabel.text=randomNum;
.h file:
int randomNum;
int guess;
IBOutlet UITextField *numberField;
IBOutlet UILabel *randomNumLabel;
Upvotes: 0
Views: 91
Reputation: 163288
You'll need to convert the number to a string by using NSString
's stringWithFormat:
method.
randomNumLabel.text = [NSString stringWithFormat:@"%i", randomNum];
Upvotes: 2