title: How to set countdownTimer for each day in ios?
body: <p>I have to check current time of device and set countdownTimer for the remaining time in a day.And reset label time at 12 am everyday (timer get restart as 23:59).</p>
  
  <pre><code>- (void)updateCountdown {   
      NSDate *tomorrow = [[NSUserDefaults standardUserDefaults] valueForKey:@"Date"];  
      NSTimeInterval secondsPerDay = 24 * 60 * 60;  
      NSDate *date = [tomorrow dateByAddingTimeInterval:secondsPerDay];  
      NSDate *startingDate = [NSDate date];  
      NSDate *endingDate = date;  
  
      NSCalendar *calendar = [NSCalendar currentCalendar];  
      NSUInteger unitFlags = NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit|NSHourCalendarUnit|NSMinuteCalendarUnit|NSSecondCalendarUnit;  
      NSDateComponents *dateComponents = [calendar components:unitFlags fromDate:startingDate toDate:endingDate options:0];  
  
      NSInteger hours    = [dateComponents hour];  
      NSInteger minutes  = [dateComponents minute];  
      NSInteger seconds  = [dateComponents second];  
      NSString *countdownText = [NSString stringWithFormat:@" %ld Hours %ld Minutes %ld Seconds", (long)hours, (long)minutes, (long)seconds];  
      lblRemainigText.text = countdownText;  
      [self performSelector:@selector(updateCountdown) withObject:nil afterDelay:1];  
  
  }
  </code></pre>
  
  <p>Thanks in Advance.</p>