Ey guys, having some problems with formatting a string and passing it to a label. Here is my code:
The NSLog that I have noted in the code above works perfectly, but I am having trouble assigning it to the minsToGo label. I believe I am passing in a string but have no idea why its not working. Even this doesn't work:
I bet it is something really stupid or simple that I am overlooking, if so I am sorry, but I am just not seeing the problem. Any help appreciated. Thanks!
Code:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"HH:mm:ss"];
NSLog(@"%@", [formatter stringFromDate:d]); //outputs everything properly
[formatter release];
NSString *minsToGoLabelTextStr = [[NSString alloc] initWithString:[formatter stringFromDate:d]];
minsToGo.text = minsToGoLabelTextStr;//problem here
[minsToGoLabelText release];
[minsToGoLabelTextStr release];
Code:
minsToGo.text = [formatter stringFromDate:d];