Recent

Author Topic: Virtual Keyboard Bug on iOS6  (Read 3463 times)

wagenheimer

  • New Member
  • *
  • Posts: 21
Virtual Keyboard Bug on iOS6
« on: February 05, 2013, 11:57:35 am »
Hi!

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 do 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

wagenheimer

  • New Member
  • *
  • Posts: 21
Re: Virtual Keyboard Bug on iOS6
« Reply #1 on: February 15, 2013, 02:53:35 pm »
Problem fixed!

I was a resignFirstResponder() which was causing it.

I changed it from textFieldShouldReturn to textFieldDidReturn and problem is gone! =)