Converting integer/numeric values to Strings
My problem is : I need to take the numeric score value stored in an 'int' variable and convert it to an NSString or similar object that I can use to draw the score directly on to the screen. I can't seem to find any way to convert it, and using [NSString stringWithFormat:]; isn't working for me.
I'm sure this is pretty simple...any ideas?
I'm sure this is pretty simple...any ideas?
The proper way to do it with an NSString is
[NSString stringWithFormat:@"%d", intValue];
Of course, you will need to either retain it or use copy, otherwise it will be deleted next time the autorelease pool is emptied.
[NSString stringWithFormat:@"%d", intValue];
Of course, you will need to either retain it or use copy, otherwise it will be deleted next time the autorelease pool is emptied.
Thanks! I knew I was missing something simple. The game also crashes on my girlfriend's computer for some reason, even though the completely compiled game runs fine as a stand-alone executable on my computer. We also have the exact same computer : iBook G4 1.33 / 512 with Mac OS 10.4. I'm thinking it's either A) she needs a system update, B) I have a memory leak, or C) there's a problem loading the music, sound, and graphics on her computer. The last version of the game I sent her ran fine, but this one gives her a "Ended unexpectedly" error when she tries to run it. Any ideas of what's most likely wrong? I'm going to mess with it and tighten up my code and see if this fixes the issue.
check console.app for error information, if there isnt anything put NSLog's in and around bits of code you think could be causing the crash.. like loading game resources.
Sir, e^iπ + 1 = 0, hence God exists; reply!
Nope..I'm using the "Release" build configuration.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| generate MD5 strings with Objective-C? | fernandovalente | 3 | 3,664 |
Jan 27, 2010 09:29 AM Last Post: Hog |
|
| Use an integer value as part of a variable name | PHANTOMIAS | 5 | 3,390 |
Dec 8, 2009 09:24 AM Last Post: PHANTOMIAS |
|
| Die-hard vertex-sorting function not accepting input values! | mikey | 6 | 3,271 |
Oct 31, 2009 03:36 AM Last Post: mikey |
|
| C strings | mikey | 24 | 7,671 |
May 18, 2009 04:52 AM Last Post: Oddity007 |
|
| Where are strings? | Tekkan | 2 | 2,469 |
Jun 17, 2007 02:44 AM Last Post: Fenris |
|

