I'm working on a fairly simple iPhone app to solve the quadratic equation, mostly because it's so easy-at least the concepts and math!
I've created an interface in Interface Builder that has a couple Labels, 3 text fields (varAfield, etc) and a Solve button. The 3 text fields which are set as UITextFieldDelegate have been set so that they automatically show the "Numbers and Punctuation" keyboard. This code is used to dismiss the keyboard, then automatically move to the next variable when the user taps the return key (which says "Next" except for variable C which says "Done"
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if (theTextField == varAfield) {
[varAfield resignFirstResponder];
[varBfield becomeFirstResponder];
}
if (theTextField == varBfield) {
[varBfield resignFirstResponder];
[varCfield becomeFirstResponder];
}
if (theTextField == varCfield) {
[varCfield resignFirstResponder];
}
return YES;
}
Anyway, the problem occurs with the first instance of becomeFirstResponder. The keyboard comes up as it should, however, it's using an ASCII keyboard instead of "Numbers and Punctuation" The second time it's called, it works as it should. Also, if I start from variable A again it will work fine. No matter where I move the first instance of becomeFirstResponder, the first (and only first) time it's called within the app, it doesn't behave correctly.
Update: becomeFirstResponder still (even on the first instance) respects my choice of return key, but no matter which keyboard is set, it still shows the "ASCII Capable" one. So what's going on? I've checked everything in IB and it appears to be ok...