user1923975
user1923975

Reputation: 1389

Click button to amend textfield, textFieldDidEndEditing not called?

So i've got a couple of checks going on within textFieldDidEndEditing which basically enable or disable the input of a text box, they seem to be working fine.

When I have an IBAction associated with a button that affects the values inside of a text box, does textFieldDidEndEditing not get called? It seems to only respond when i'm actually within a textBox typing.

I have this method which resets my text boxes and I want to run textFieldDidEndEditing after it but don't know how to pass a generic textField to it as the sender of the reset method isnt a text field.

- (IBAction)reset;
{
    txtCost.text = @"";
    txtPrice.text = @"";
    txtProfit.text = @"";
    txtMargin.text = @"";
    txtMarkup.text = @"";
    txtTaxPercentage.text = @"";
    txtTaxAmount.text = @"";



} 

Thanks, any clarification or help would be great.

Upvotes: 0

Views: 1002

Answers (1)

Mark McCorkle
Mark McCorkle

Reputation: 9414

The delegate method textFieldDidEndEditing will not be called if you are manually changing the text inside of a textField using another sender. That delegate method responds to resignFirstResponder so it will never be fired in your case.

What you can do is manually call it though based on the textField you want.

[self textFieldDidEndEditing:_yourTextField];

Upvotes: 4

Related Questions