Help Storing Input into a Variable

Discussion in 'iPhone/iPad Programming' started by keeweepoo, Dec 12, 2009.

  1. macrumors newbie

    Joined:
    Dec 26, 2007
    Messages:
    9
    #1
    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

    Code:
    -(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?
     
  2. macrumors regular

    drf1229

    Joined:
    Jun 22, 2009
    Messages:
    237
    #2
    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.
     
  3. macrumors newbie

    Joined:
    Dec 26, 2007
    Messages:
    9
    #3
    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.
     
  4. macrumors regular

    drf1229

    Joined:
    Jun 22, 2009
    Messages:
    237
    #4
    I see... Well it looks like you need to learn Objective C for the basics. Although its not exact it will get you familiar with most of the foundations you'll need to know.
     
  5. macrumors newbie

    Joined:
    Dec 26, 2007
    Messages:
    9
    #5
    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.
     

Share This Page