Hey all,
I have this textfield method that i am using:
Code:
- (void)textFieldDidEndEditing:(UITextField *)textField;
Fairly straight forward. But it means that for the method to be executed the user needs to move away from the text field. This in my situation can cause some bugs so i need to save the value in the textfield as the user is going rather than at the end of their typing and moving to the next text field.
to do this i have thought of calling the above method on ValueChanged of a textField. But would this work or would it still require the textField to end editing for the contents of the method to be executed?
the method looks like this:
Code:
switch (textField.tag) {
case 1:
if(textField != nil)
{
self.savedName = textField.text;
}
break;
....
The problem with this i have been coming across so far is that i cannot reference to the textfield from anywhere else, even if i am using a property to assign the reference to the field when i create it:
Code:
if ([indexPath section] == 0) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(25, 7, 285, 35)];
textField.adjustsFontSizeToFitWidth = YES;
textField.delegate = self;
textField.textColor = [UIColor blackColor];
if ([indexPath section] == 0) {
if ([indexPath row] == 0) {
//textField.delegate = self;
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
textField.placeholder = @"Name";
textField.keyboardType = UIKeyboardTypeDefault;
textField.returnKeyType = UIReturnKeyDone;
textField.tag = 1;
textField.text = self.savedName;
}