Reputation: 73
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.
Upvotes: 5
Views: 9218
Reputation: 11
for Swift 3.0
place these lines where you need
let yourString: String = ""
yourString = textField.text
Actually text attribute of textField provide the value to String.
Upvotes: 0
Reputation: 4606
lblAns.text=[NSString stringWithFormat:@"%i",[[txtField1 text] intValue] + [[txtField2 text] intValue]];
you can do addition of two textboxs value like this...
Upvotes: 0
Reputation: 2489
NSString *s = textfield.text;
yourString = [yourString appendString:s];
Upvotes: 0