title: Pause Stop watch timer in iPhone?
body: <p>I am new to NSTimer in iPhone. i made a stop watch. now i want to pause time in between
  and also want to do resume pause. my code is given bellow.</p>
  
  <ul>
  <li>How can I pause time?</li>
  <li>How can i resume from where the time is stop?</li>
  </ul>
  
  <p>Start Time:</p>
  
  <pre><code>startDate = [[NSDate date]retain];
  stopWatchTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/10.0
                                                        target:self
                                                      selector:@selector(updateTimer)
                                                      userInfo:nil
                                                       repeats:YES];
  </code></pre>
  
  <p>Stop Time:</p>
  
  <pre><code>[stopWatchTimer invalidate];
  stopWatchTimer = nil;
  [self updateTimer];
  </code></pre>
  
  <p>Update Time:</p>
  
  <pre><code>(void)updateTimer
  {
      NSDate *currentDate = [NSDate date];
      NSTimeInterval timeInterval = [currentDate timeIntervalSinceDate:startDate];
      NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timeInterval];
      NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
      [dateFormatter setDateFormat:@"mm:ss"];
      [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]];
      NSString *timeString=[dateFormatter stringFromDate:timerDate];
      stopWatchLabel.text = timeString;
      [dateFormatter release];
  }
  </code></pre>