I am trying to make a game on Xcode and I would like an alert message to pop up when the user reaches a certain score, say 100 points. I’ve got the code to make an alert pop up when the view loads up. But what I would like is for the alert message to only show when the player gets to a certain score.
The game’s scoring works like this: every time the player clicks/taps a button, he gets one point, so he gets 100 points after tapping 100 times.
Here’s the code to make the alert message pop up when the view loads up:
- (void)viewDidLoad
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Tile" message:@"This is the message" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alert show];
[alert release];
[super viewDidLoad];
}
In your button action call method to show alert when point reaches 100.
For example