Search code examples
rubymotion

How to hide the keyboard that pops up in RubyMotion?


How does one hide the virtual keyboard that pops up in a text field?

The button that hides it does not seem to appear and in my case, the next screen that loads (which does not have a text field) will still have the keyboard in the loaded position.

Thanks!

Update:

Using the following allows the keyboard to return:

  def textFieldShouldReturn textField
     textField.resignFirstResponder
    'YES'
  end

However, it still remains open upon the next screen.


Solution

  • it should be true instead of 'YES' and don't forget to set the textfield delegate

     def textFieldShouldReturn textField
        textField.resignFirstResponder
        true
      end