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

Programmer

macrumors member
Original poster
I have a an NSInteger in my application called score and i want to show the score integer in a UILabel. I Tried the formatWithObject method but for some reason it did't work.

ScoreLabel.text = [NSString formatWithObject😡"%d", (int) score];

Any help is appreciated.
 
Code:
NSString *scoreString = [[NSString alloc] initWithFormat:@"%d", score];
ScoreLabel.text = scoreString;
[scoreString release];
[COLOR="Green"]//you can also use %i conversions for integers[/COLOR]
 
I tried the formatWithObject method but for some reason it did't work.
That's because NSString has no formatWithObject: class method. In fact, nothing does. You're gonna want to avoid making up your own API methods and stick to the ones provided to you.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.