#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Array value by using textField


    I wanna to insert array value by using textField.

    we can initialize array value like this.

    [Array addObject:NslocalizedString(@"Hai",nil)];

    How can I insert array value from a textFiled by user input.

    Please help me.

    Thank You.
  2. #2
  3. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    12
    Rep Power
    0
    To set the dynamic text equal to that of an array index try something like,
    PHP Code:
    var btnArray:Array = new Array("btn1", "btn2", "btn3");
    dynamicTextField.text = btnArray[0]; // traces "btn1"
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2011
    Posts
    119
    Rep Power
    0

    Please find the solution.


    Hi Dear

    YES, We can do this We need to save the text entered in text field in a string.
    NSString *str=[[NSString alloc] alloc];
    Now add TEXT FIELD data in ‘str’

    And then [Array addObject:str];

    Similar can be done again and again. This will save the text field data in Array.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Dallas, TX
    Posts
    50
    Rep Power
    2
    I don't think the other replies really answered your question, which (I think) is asking how to take the value from an input UITextField and insert it into an array, you'd simply use the "text" method of the textField:

    // assuming we have a UITextField called "textField"
    NSMutableArray *theArray = [[NSMutableArray alloc] init];
    [theArray addObject:textField.text];


    However, let me know if that does not answer your question.

IMN logo majestic logo threadwatch logo seochat tools logo