Possible Duplicate:
How to convert from int to string in objective c: example code…
How to convert integer to string in Objective C?
We can convert int value to Double object by instantiating Double class or calling Double. valueOf() method. Let's see the simple code to convert int to Double in java.
NSArray *myArray = [NSArray arrayWithObjects:[NSNumber numberWithInt:1], [NSNumber numberWithInt:2], [NSNumber numberWithInt:3]];
Update for new Objective-C syntax:
NSArray *myArray = @[@1, @2, @3];
Those two declarations are identical from the compiler's perspective.
if you're just wanting to use an integer in a string for putting into a textbox or something:
int myInteger = 5; NSString* myNewString = [NSString stringWithFormat:@"%i", myInteger];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With