Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cpagal

macrumors newbie
Original poster
May 22, 2010
4
0
I have a textfield named "textField" and a label named "label".I want to add sum numbers an divide to the number i get from the "textField" and then print it on the label.

I'm trying something like:

int a = [textField.text integerValue];
a = a + 2;
label.text = a;

But it says passing argument 1 of setText. I suppose i have to make textfield a string and then the string to integer.

Please help!
 
textfield.text is a string and you've already converted it to an integer. The part you're missing is converting the int back to a string (for label.text).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.