0

I have a problem with the Virtual Keyboard which only occurs on iOS 6.

I have a UITextField which I use to catch keyboard imput from the Virtual Keyboard, but on iOS 6 it only shows once, after the keyboard closes for the first time it is not show anymore.

Here is the code I use to show the TextField with the Keyboard.

if not Assigned( keysTextField ) Then
begin
  keysTextFrame := wndHandle.frame;
  keysTextField := zglCiOSTextField.alloc().initWithFrame(keysTextFrame );
  keysTextTraits := keysTextField;
  with keysTextField, keysTextTraits do
    begin
      setDelegate( appDelegate );
      setAutocapitalizationType( UITextAutocapitalizationTypeNone );
      setAutocorrectionType( UItextAutocorrectionTypeNo );
      setKeyboardAppearance( UIKeyboardAppearanceDefault );
      setReturnKeyType( UIReturnKeyDone );
      setSecureTextEntry( FALSE );
      addTarget_action_forControlEvents( appDelegate, objcselector('textFieldEditingChanged' ), UIControlEventEditingChanged );
    end;
  keysTextField.setText( utf8_GetNSString( Text ) );
  wndHandle.addSubview( keysTextField );
end;

if appFlags and APP_USE_ENGLISH_INPUT > 0 Then
  keysTextTraits.setKeyboardType( UIKeyboardTypeASCIICapable )
else
  keysTextTraits.setKeyboardType( UIKeyboardTypeDefault );

wndHandle.addSubview( keysTextField );
keysTextField.becomeFirstResponder();

and here is the code to dismiss it :

if Assigned( keysTextField ) Then
  keysTextField.removeFromSuperview();

Anybody have any ideia of what I can try to solve this problem? I checked, the second time, keyTextField.isFirstResponder() returns true, so it should be working (And works in iOS < 6).

Thanks

Cezar Wagenheimer

1 Answers1

0

Fixed changing the command

keysTextField.resignFirstResponder(); from textFieldShouldEndEditing to textFieldDidEndEditing!

Royston Pinto
  • 6,681
  • 2
  • 28
  • 46