1

Possible Duplicate:
NSTimer doesn't stop

How can I stop / invalidate a NSTimer??

Below is the code:

- (void)autoscrollTimerFired:(NSTimer*)timer {

   NSLog(@"Each & Every Time this MEthods is called Even if I try to invalidate it in viewDidDisappear "); 
}


- (void)viewWillAppear:(BOOL)animated{

    if (autoscrollTimer == nil) {
        autoscrollTimer = [NSTimer scheduledTimerWithTimeInterval:(35.0/1000.0)
                                                           target:self
                                                         selector:@selector(autoscrollTimerFired:) 
                                                         userInfo:nil 
                                                          repeats:YES]; // To repeat this thread it's as per my requirement
    }
}

-(void) viewWillDisappear:(BOOL)animated {

    [autoscrollTimer invalidate];
}

So,please suggest me to do this ...

Community
  • 1
  • 1
Ajay Sharma
  • 4,509
  • 3
  • 32
  • 59

1 Answers1

3

I had the same problem. I guess you have made it as property nonatomic, retain?

Please do this:

[self.autoscrollTimer invalidate];

Thanks.

Naveed Rafi
  • 2,503
  • 5
  • 32
  • 40