Author Topic: UIInput forces iOS keyboard to be always uppercase when hideInput is enabled  (Read 3973 times)

liu_yin_

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
I am using UIInput in NGUI 3.6.7 to implement a text input field. However, I found a very strange behavior. If I select "Hide Input" in the inspector, and deploy the build to iOS device, the input will force the keyboard to be uppercase for every keystroke (usually the keyboard is in uppercase mode when opened, and switch to lowercase after first keystroke).

It seems this issue is only related to "Hide Input" flag since the keyboard works fine if I don't select "Hide Input". In addition, based on my observation, it seems UIInput is reopening keyboard each time when a key is pressed since the "Caps Lock" key flashes with each keystroke when "Hide Input" is selected.

Is it an issue with NGUI or Unity?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
My guess is tht it's related to iOS capitalizing the first letter in a word by default. When the input is hidden, there is no data in the TouchScreenKeyboard. Instead it's used only to input characters individually. Since each character ends up being the first character, iOS takes the liberty of capitalizing it. I'm not sure if there is an option to turn this off via Unity. I suggest playing with the code that opens the keyboard in UIInput's line 600.

hrlarsen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 35
    • View Profile
It is related to the way that autocapitalization works in iOS and how NGUI is getting it's inputs. For a workaround see my answer here http://www.tasharen.com/forum/index.php?topic=9960.msg47765#msg47765

hemantparmar23

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 1
    • View Profile
For a workaround you can also use the OnChange method of the UIInput script and concert your input to lower case for each character you enter.