PDA

View Full Version : Help Storing Input into a Variable




keeweepoo
Dec 12, 2009, 04:42 PM
Hi, i would to have a few text input boxes storing the user input into a variable. as of now i am able to declare the UITextFields, and when the user selects the submit button it passes the user input as follows

-(IBAction) submitYourName;
{
lblUserTypedName.text = [NSString stringWithFormat: @"hello your name is %@ %@", txtUserName.text, txtUserName2.text];
}

So that the two text fields are now shown. I am sure this is a round about way of passing input data, but I would really like to be able to store the input into a variable for each. Advice on how I can start learning this?



drf1229
Dec 12, 2009, 07:40 PM
Hi, i would to have a few text input boxes storing the user input into a variable. as of now i am able to declare the UITextFields, and when the user selects the submit button it passes the user input as follows

-(IBAction) submitYourName;
{
lblUserTypedName.text = [NSString stringWithFormat: @"hello your name is %@ %@", txtUserName.text, txtUserName2.text];
}

So that the two text fields are now shown. I am sure this is a round about way of passing input data, but I would really like to be able to store the input into a variable for each. Advice on how I can start learning this?

Please explain your thinking a little more. What exactly are you trying to do? Do you want to take the text from your txtUserName field into a variable you can use multiple times. If so, you might want to to store it into an NSString, as you seem to know how to use.

keeweepoo
Dec 13, 2009, 11:37 AM
Thanks for the reply.

I am essentially wanting to have five different text inputs, and each input I would like to store into a variable. So, after the user has typed in data for each of the five text inputs, I then take each of those variables and do some math with them. However, I am finding it hard to find variable tutorials so seeking some help.

drf1229
Dec 14, 2009, 03:25 PM
I see... Well it looks like you need to learn Objective C (http://www.iu.hio.no/~mark/CTutorial/CTutorial.html#Variables) for the basics. Although its not exact it will get you familiar with most of the foundations you'll need to know.

keeweepoo
Dec 15, 2009, 05:14 PM
That url you sent shows me how to declare and work with variables which I've learned using PHP and regular C. I'm trying to find out how to store and use these variables throughout my .h, .m, and interface builder. Any help would be greatly appreciated.

Also, that tutorial is for C and not ObjC.