I am currently using this code to put some text on the screen
userOutput.text=@"";
I want to be able to display an int variable in the string, like you do with printf in C with the %d placeholders. How do I do this with an NSString
I am currently using this code to put some text on the screen
userOutput.text=@"";
I want to be able to display an int variable in the string, like you do with printf in C with the %d placeholders. How do I do this with an NSString
use NSString's +stringWithFormat:
method:
userOutput.text= [NSString stringWithFormat: @"%d", 100];
It uses exactly the same format specifiers as printf function in c.
int whatever = 42;
userOutput.text = [NSString stringWithFormat:@"%d", whatever];