How to display integer?
Hello!
I'm wondering how to display an integer.
Should i convert the integer into a string which i display?
How do I do that? What code?
Kind regards
lightlab
I'm wondering how to display an integer.
Should i convert the integer into a string which i display?
How do I do that? What code?
Kind regards
lightlab
Create a label and use this code
Hope this helps
Chris
Code:
labelsName.text = [NSString stringWithFormat:@"%d", integersName];Chris
I got this code working:
NSString *s = [NSString stringWithFormat:@"%i", integersName];
[s drawAtPoint:CGPointMake(320/2,480/2) withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]];
But its displayed upside down!
How do i fix that?
NSString *s = [NSString stringWithFormat:@"%i", integersName];
[s drawAtPoint:CGPointMake(320/2,480/2) withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]];
But its displayed upside down!

How do i fix that?
I have the digits handy as textures for drawing and I use a numeric to array of digits function that looks like this:
unsigned numberToDigits(unsigned num) {
unsigned digits;
digits = 0;
do {
digit[digits++]=num % 10;
num /= 10;
} while (num > 0);
return digits;
}
unsigned numberToDigits(unsigned num) {
unsigned digits;
digits = 0;
do {
digit[digits++]=num % 10;
num /= 10;
} while (num > 0);
return digits;
}
lightlab Wrote:I got this code working:
NSString *s = [NSString stringWithFormat:@"%i", integersName];
[s drawAtPoint:CGPointMake(320/2,480/2) withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]];
But its displayed upside down!
How do i fix that?
Turn your iPhone upside down!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Define Random Integer (Best Way) | 9livesoftware | 2 | 2,664 |
Sep 24, 2009 11:09 PM Last Post: Bachus |
|

