Can't use NSString to put a number on screen?
I'm trying to put up a number, a float to be exact, on a custom view. It's part of a simple animation loop using NSTimer, but anyhow, I can't think of a way to use make NSMutableString accept a number.
I understand for arrays and such, I can use NSNumber numberWithFloat:0.0 to convert to an object, but NSNumber doesn't have the displaying functionality that NSMutableString has.(like NSString)
So, how do I convince NSMutableString to accept the float (or any number)? I can do normal text just fine. Or there's a different way to do it without going through NSMutableString's drawing method? I'm guessing it's one of those fundamental things a newbie like myself has to ask.. it's probably too basic people don't even write about it.
I understand for arrays and such, I can use NSNumber numberWithFloat:0.0 to convert to an object, but NSNumber doesn't have the displaying functionality that NSMutableString has.(like NSString)
So, how do I convince NSMutableString to accept the float (or any number)? I can do normal text just fine. Or there's a different way to do it without going through NSMutableString's drawing method? I'm guessing it's one of those fundamental things a newbie like myself has to ask.. it's probably too basic people don't even write about it.
Code:
+[NSMutableString stringWithFormat]
got it. thanks. I kept on bangin' the setString: method, no wonder it didn't work. Is that method inherited from NSString? cuz I dont' see it in the NSMutableStrings list.. oh well, classes are cool, but things are so hard to comprehend when I'm still learning the class hiarchy.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Malloc() Struct with NSString Inside? | Graphic Ace | 3 | 3,791 |
Jan 26, 2010 05:32 PM Last Post: cmiller |
|
| What do you want to see in a Random Number Generator? | Justin Brimm | 16 | 6,405 |
Jan 21, 2007 10:38 AM Last Post: Justin Brimm |
|
| Getting Number From Character In NSString | Nick | 2 | 3,816 |
Oct 31, 2005 10:08 AM Last Post: Nick |
|
| Even Number of Triangles for Any 3D model | unknown | 1 | 2,497 |
Sep 21, 2005 08:34 AM Last Post: Zekaric |
|
| random number | Kaamoss | 14 | 4,921 |
May 13, 2005 03:03 AM Last Post: DoG |
|

