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

    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    TextField with tableView


    How can i insert tableview value from textField.
    Please help me.
  2. #2
  3. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    13
    Rep Power
    0
    My suggestion is to not use custom UITableViewCells. I used to do it your way, but there's a much better way. Use the accessoryView property of the UITableViewCell, which you can assign an arbitrary view to, such as a UITextField or UISwitch. It shows up exactly as it would in the Settings application.

    Then, when you need to access it, just use

    NSString *text = ((UITextField *)cell.accessoryView).text;
    However, you must be careful about setting up cells and accessing their values. If any cell goes offscreen, it will be removed and you will not be able to access the text field. What you want to do when setting up your cell is:

    cell.accessoryView = nil; //Make sure any old accessory view isn't there.
    if (/*cell needs text field*/) {
    UITextField *textField = [[[UITextField alloc] initWithFrame:frame] autorelease];
    textField.text = savedValue;
    cell.accessoryView = textField;
    [textField addTarget:self action:@selector(textChanged forControlEvents:UIControlEventValueChanged];
    }

    ...

    - (void) textChangedUITextField *)source {
    self.savedValue = source.text;
    }
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2011
    Posts
    140
    Rep Power
    0

    Answer of your question.


    Hi Dear

    I havnít fully understtod your Question.
    If you need to enter TEXT FILD data in TABLE VIEW , this can be done in many ways.
    The most simplest way is to store the text field data in STRING and then insert that string in to array. Once your array with data is ready you can simply use that ARRAY to display its data in table view cell.

    Thanks
    Diya

IMN logo majestic logo threadwatch logo seochat tools logo