Note that there are some explanatory texts on larger screens.

plurals
  1. POchecks for which UITextField will be triggered (textFieldShouldBeginEditing)
    text
    copied!<p>I have been trying to implement the checks for which UITextField will be triggered. Here are the results of my findings for first two text fields only. This gives me two errors that says "sender undeclared"... Where am I doing wrong? Thanks in advance properties and synthesize are OK! val is the tag value of the buttons for a caLculator.(such 0,1,2,3,4,5,6,7,8,9) </p> <pre><code>//.h file IBOutlet UITextField *textFieldLoanAmountDisplay; IBOutlet UITextField *textFieldInitDepositDisplay; // .m file const NSString *textField1Code= @"1"; const NSString *textField2Code= @"2"; -(BOOL)textField1ShouldBeginEditing:(UITextField *)textFieldLoanAmountDisplay { if (textFieldLoanAmountDisplay == textField1Code) { UIButton *buttonPressed = (UIButton *)sender; int val = buttonPressed.tag; if ( [textFieldLoanAmountDisplay.text compare:@"0"] == 0 ) { textFieldLoanAmountDisplay.text = [NSString stringWithFormat:@"%d", val ]; } else { textFieldLoanAmountDisplay.text = [NSString stringWithFormat:@"%@%d", textFieldLoanAmountDisplay.text, val ]; } } return NO; } -(BOOL)textField2ShouldBeginEditing:(UITextField *)textFieldInitDepositDisplay { if (textFieldInitDepositDisplay == textField2Code) { UIButton *buttonPressed = (UIButton *)sender; int val = buttonPressed.tag; if ( [textFieldInitDepositDisplay.text compare:@"0"] == 0 ) { textFieldInitDepositDisplay.text = [NSString stringWithFormat:@"%d", val ]; } else { textFieldInitDepositDisplay.text = [NSString stringWithFormat:@"%@%d", textFieldInitDepositDisplay.text, val ]; } } return NO; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload