I am making an app where there is a test. I made a mistake of having different classes for each like 10 questions, to group them. Now I have a working stopwatch in the first class, but obviously it stops when i go to the next class (10 questions), how can I access the NSTimer in the other class from the new class and CONTINUE the timer. Here is my timer code:
- (void)viewDidLoad {
gameTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(gameTimerVoid) userInfo:nil repeats:YES];
[super viewDidLoad];
}
-(void)gameTimerVoid {
int now;
now = [gameTime.text intValue];
int after;
after = now + 1;
gameTime.text = [NSString stringWithFormat:@"%i", after];
}
In your case the timer seems the sharable assets across most of your files So you would consider having it in the separate class and could be accessed by any files (class) from there,then for doing such you need to use the singleton class design pattern,