Hi, I'm developing a little game in which I want the user to be able to change the settings. I want to use segmented control to do this, but have no experience using segmented control and don't know where to start.
I want to have a display of options (15s, 30s, 45s, 60s) and the user can choose whichever they want. After choosing an option and pressing play, the option they choose should update the seconds variable in the code below:
How should I go about doing this? Thanks!
I want to have a display of options (15s, 30s, 45s, 60s) and the user can choose whichever they want. After choosing an option and pressing play, the option they choose should update the seconds variable in the code below:
Code:
- (void)setupGame {
// 1
seconds = 30;
count = 0;
highScore = setHigh;
// 2
timerLabel.text = [NSString stringWithFormat:@"Time: %i", seconds];
scoreLabel.text = [NSString stringWithFormat:@"Score:\n%i", count];
highLabel.text = [NSString stringWithFormat:@"High Score:\n%i", highScore];
// 3
timer = [NSTimer scheduledTimerWithTimeInterval:1.0f
target:self
selector:@selector(subtractTime)
userInfo:nil
repeats:YES];
[backgroundMusic setVolume:0.3];
[backgroundMusic play];
}
How should I go about doing this? Thanks!