views:

248

answers:

3

How would I go about getting a string from a UITextField in the iPhone SDK? I'm trying to insert it into another concatenated string.

+5  A: 

This should do it:

NSString *myString = myTextField.text;
Chris Long
Thanks! It worked! I know it's really simple, but I was doing something wrong before...
Adam
A: 

lblAns.text=[NSString stringWithFormat:@"%i",[[txtField1 text] intValue] + [[txtField2 text] intValue]];

you can do addition of two textboxs value like this...

rkloves
A: 

nsstring *s=textfield.text;

your string=[your string appendstring:s];

pankaj kainthla