Heya again, I have been having problems creating a UISlider that can be used to modify a NSTimer I created. Essentially the slider is ment to modify the interger that the NSTimer is counting down from, but when I try to move the UISlider, the application crashes, I'm assuming this is because it is interfering with the countdown that is occuring, but I don't know what to do to fix this.
Here is the relevant code
- (void)viewDidLoad {
[label setFont:[UIFont fontWithName:@"DBLCDTempBlack" size:36.0]];
label.text = @"I0A0IN6";
mainInt = mySlider.value;
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/1.0) target:self selector:@selector (timerVoid) userInfo:nil repeats:YES];
[super viewDidLoad];
}
- (void)timerVoid {
mainInt += -1;
if (mainInt == 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Break Time!"
message:@"Time to take a break, please go to the exorcises page during your break inorder to maximise it"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
[mainInt invalidate];
}
[label setFont:[UIFont fontWithName:@"DBLCDTempBlack" size:36.0]];
label.text=[NSString stringWithFormat:@"%d" , mainInt];
}
The slider is called mySlider, and it is modifying the interger "mainInt" (line 5).
thanks in advance