Hey everyone, right now I have a a timer (in seconds). I need to convert that to hours/mins/seconds/milliseconds and then use that as the title for a UILabel.
I've looked into NSDateformatter but can't quite figure it out.
Any help would be appreciated.
Here's what I have right now, but all I get is a blank Label:
I've looked into NSDateformatter but can't quite figure it out.
Any help would be appreciated.
Here's what I have right now, but all I get is a blank Label:
Code:
-(void)updateTimer {
NSString *secondsPassed = [NSString stringWithFormat:@"%i",incr];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"HH:mm:ss"];
[dateFormat setTimeZone:[NSTimeZone systemTimeZone]];
NSDate *formattedString = [dateFormat dateFromString:secondsPassed];
myTimer.text = [dateFormat stringFromDate:formattedString];
}