I think the issue is because you put the random generation snippet inside your IBAction, as you stated in your comment:
this is the method which takes the value submitted in the field
which means the code inside guessNow:sender will be triggered every time the user clicks on the button, that means you generate a random number every time the user submits a guess which makes no sense.
//this is the method which takes the value submitted in the field and changes the label display after the user clicks the guess now button
- (IBAction)guessNow:(id)sender {
//set the random siri guess value between 1 and 100
int answer = 0;
answer = arc4random() % 100 + 1;
self.usersGuess = self.guessNumberField.text;
you should put that code block inside viewDidLoad() and add a property _answer to your .h
Here is a quick solution, I did not write this on XCode so might have syntax error
in your .h, add
@property (strong) int _answer;
in your .m, remove this from guessNow:sender
int answer = 0;
answer = arc4random() % 100 + 1;
and add this to your viewDidLoad()
answer = arc4random() % 100 + 1;
Also you might want to add another button to reset the random number, so I would say to isolate the random number generation out to a private method like this in your .m
- (void)generateRandomNumber
{
self.answer = arc4random() % 100 + 1;
}
So that, you can use this method in your viewDidLoad() to generate the initial random number and use it for reset button, if any
hope it helps.