Helpful Information
 
 
Category: iPhone SDK Development
TextField with tableView

How can i insert tableview value from textField.
Please help me.

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) textChanged:(UITextField *)source {
self.savedValue = source.text;
}

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










privacy (GDPR)