This is probably a noob question but I’ve been trying to figure it out for a few hours now and I can’t. I want to make a label show the number of an integer variable.
What I’ve done is that I’ve declared a variable x as integer, I give that variable the number 100 and then I am trying to show that number to a label.
I tryed this but it isn’t working.
x = 100;
label.text = [[NSString alloc] initWithFormat: @”%.2f”, x];
This takes place inside a button.
Thanks in advance
You have to use ‘%d’ instead of ‘%.2f’. ‘%f’ is for float, not int.