views:

1308

answers:

1

I have a UITextView and 2 UITextField set up. UITextView resigns first responder status when empty part of the screen is tapped, the same for the 2 UITextField, plus for these 2, the return key also resigns first responder status. All 3 are declared in interface.

I would like to get the contents of all of these to individual NSString and/or learn how to enter them directly into something like:

NSString *urlstr = [[NSString alloc] initWithFormat:@"http://server.com/file.php?var1=%@&var2=%@&var3=%@", *content of UITextView*, *content of UITextField*, *content of UITextField*];

This is a very basic question, i know, but i'm pretty much a novice. If i learn how to do this i'll probably be able to pick up from there.

cheers

(edited)

+3  A: 

UITextField and UITextView both have a text property that you can use to retrieve the string values. For example,

NSString *string = [NSString stringWithFormat:@"%@, %@", textField.text, textView.text];

Keep in mind you'll probably want to examine the strings to make sure they're not empty or contain invalid characters before putting them into a URL.

Marc Charbonneau