turn int to NSString?

Phate
Unregistered
 
Post: #1
ok, in my sidescroller I now have mouse controlled aiming (with two different weapons), and enemies that die. Now I need to draw your score to the screen, at the moment I have your score stored as an int, what's the code to change it into an NSString? (in RB I used the "str" function).

Thanks,
Phate
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Code:
[NSString stringWithFormat:@"%d", myInt]
Quote this message in a reply
furballphat
Unregistered
 
Post: #3
Do something along the lines of:

Code:
NSString *myString;

myString = [NSString stringWithFormat: @Your score is "%d", 20;
NSLog (myString);

This will print out "Your score is 20".
Quote this message in a reply
Phate
Unregistered
 
Post: #4
Thanks!

heh, I see both of you replied within a minute of eachother.

thanks for the quick reply,
Phate
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Best Engine/Framework For iPhone Turn Based Strategy? Brawnydt 6 6,398 Oct 11, 2010 06:47 PM
Last Post: MattDiamond
  Malloc() Struct with NSString Inside? Graphic Ace 3 4,460 Jan 26, 2010 05:32 PM
Last Post: cmiller
  Browser Based.. Updating turn times? guest_05 1 2,846 May 24, 2007 04:03 PM
Last Post: Tobs_
  Can't use NSString to put a number on screen? kensuguro 3 4,739 Nov 7, 2005 01:16 AM
Last Post: Jordan
  Getting Number From Character In NSString Nick 2 4,258 Oct 31, 2005 10:08 AM
Last Post: Nick