Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Stunner

macrumors newbie
Original poster
Sep 14, 2009
22
0
Ey guys, having some problems with formatting a string and passing it to a label. Here is my code:

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];
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:
Code:
minsToGo.text = [formatter stringFromDate:d];
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!
 
Wow, just found my problem, was releasing formatter too early. If any moderator could delete this thread that would be great. Sorry about that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.