title: Countdown timer using NSTimer in "0:00" format
body: <p>I have been researching for days on how to do this and nobody has an answer.</p>
  
  <p>I am creating an app with 5 timers on the same view.
  I need to create a timer that counts down from "15:00" (minutes and seconds), and, another that counts down from "2:58" (minutes and seconds). The 15 minute timer should not repeat, but it should stop all other timers when it reaches "00:00." The "2:58" timer should repeat until the "15:00" or "Game Clock" reaches 0. Right now, I have scrapped almost all of my code and I'm working on the "2:58" repeating timer, or "rocketTimer."</p>
  
  <p>Does anyone know how to do this?</p>
  
  <p>EDIT 2:
  My simulator will not even run the app so I currently have no idea if the timer is actually working or not, but from my previous attempts, it has not worked. It doesn't show up in the format that I want and it counts down by 2's (from the last time it actually worked). The problem is, also, that I'm not fluent in objective-C. I can write pseudocode all day, just like everyone else, but I cannot put what I want into code because I do not fully understand the NSTimer.</p>
  
  <p>EDIT:</p>
  
  <p>In my output, I get this error "terminate called after throwing an instance of 'NSException'"</p>
  
  <p>and this error?</p>
  
  <p><img src="https://i.stack.imgur.com/TDpeb.png" alt="my error"></p>
  
  <p>Here is my code:</p>
  
  <pre><code>    #import &lt;UIKit/UIKit.h&gt;
  
  
  @interface FirstViewController : UIViewController {
  
  
  
      //Rocket Timer
      int totalSeconds;
      bool timerActive;
      NSTimer *rocketTimer;
      IBOutlet UILabel *rocketCount;
  
      int newTotalSeconds;
      int totalRocketSeconds;
      int minutes;
      int seconds;
  
  }
  
  - (IBAction)Start;
  
  
  
  @end
  </code></pre>
  
  <p>and my .m</p>
  
  <pre><code>    #import "FirstViewController.h"
  
  @implementation FirstViewController
  
  - (NSString *)timeFormatted:(int)newTotalSeconds
  {
  
      int seconds = totalSeconds % 60; 
      int minutes = (totalSeconds / 60) % 60; 
  
  
      return [NSString stringWithFormat:@"%i:%02d"], minutes, seconds; 
  }
  
  
  -(IBAction)Start {
  
      newTotalSeconds = 178; //for 2:58
  
      newTotalSeconds = newTotalSeconds-1;
  
      rocketCount.text = [self timeFormatted:newTotalSeconds];
  
  
      if(timerActive == NO){
  
          timerActive = YES;
          newTotalSeconds = 178;
  
        [rocketTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerLoop) userInfo:nil repeats:YES];
      }
  
      else{
  
          timerActive = NO;
          [rocketTimer invalidate];
          rocketTimer = nil;
  
      }
  
  }
  
  
  
  -(void)timerLoop:(id)sender {
  
      totalSeconds = totalSeconds-1;
  
      rocketCount.text = [self timeFormatted:totalSeconds];
  
  
  }
  
  - (void)dealloc
  {
      [super dealloc];
  
      [rocketTimer release];
  
  
  }
  
  - (void)didReceiveMemoryWarning
  {
      // Releases the view if it doesn't have a superview.
      [super didReceiveMemoryWarning];
  
      // Release any cached data, images, etc that aren't in use.
  }
  
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view from its nib.
  
      timerActive = NO;
  }
  
  - (void)viewDidUnload
  {
      [super viewDidUnload];
      // Release any retained subviews of the main view.
      // e.g. self.myOutlet = nil;
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  
  @end
  </code></pre>