Is there a way to hide the keyboard?

When a search field gets the focus, the iOS keyboard is shown. If you would hide the keyboard, rotate the iPhone in landscape format. On the bottom right corner in the keyboard there is a key to hide the keyboard. Since iOS 11, this key is not available in an iPhone. Does anybody know how I can hide this keyboard from the application? Or is there a way tho show the missing key?

Example from an iPad keyboard:

Example iOS 11.0.2 on iPhone:

To the best of my knowledge that key has NEVER been shown on iPhone… but only on the iPad… Why? no idea.

But I just checked on both an iPhone and iPad (running iOS 9), and that key is NOT there on the iPhone apps, but IS there on iPad apps.

I recall having to write “special” code. to dismiss it on an iPhone (writing in Swift, but that wouldn’t matter)

I use some code found on this forum — and I apologise that I don’t have the author’s details recorded — to call ResignFirstResponder in an extension method:

Public Sub ClearFocus(extends c as iOSControl)

  Declare Sub resignFirstResponder Lib "Foundation.Framework" selector "resignFirstResponder"(obj_id As Ptr)
  
  resignFirstResponder(c.handle)

End Sub

Keyboard in landscape format in iOS 10 on an iPhone:

FWIW, the search field in Notes doesn’t show that button either. It may be that Apple just removed it.

I’m surprised by the lack of jokes here.

I went through a period of time using an iPhone with a portable bluetooth keyboard (for traveling) and there was certainly a button then. Maybe now it’s only visible if you’re paired with a keyboard or it could just be gone.

I don’t ever remember seeing that button on any iPod or iPhone regardless of model, iOS version, or orientation. Only on the iPad.

When paired with a bluetooth keyboard, the on-screen keyboard auto-hides so I don’t think it is related to BT. BT keyboards themselves often have a key to do toggle between the BT and on-screen keyboard though.

In my experience.

In my non-Xojo based iOS apps, I’ve always provided an icon or way to hide the keyboard when dealing with text areas where I allow the Return key to cause line endings. But how I do it there is not relevant to Xojo, so I only mention it because I have had to deal with this in the past for iPhone users. I’ve just never seen it on any iPhone regardless of OS level or orientation.

I have iOS version 10.3.3 on my iPhone 6 s plus and the minimize keyboard button is there.

Interesting. Are you using the stock Apple keyboard? A third-party keyboard? Wonder if there is a difference from USA versions…

I am just using the stock keyboard that came with it. It is in Canada.

I’ve never noticed that in the past. I wonder what release it got added? It does not appear to be there in iOS 11.

Either way, I think there is still a legitimate need to provide a way for the user to do it on devices and orientations where the keyboard does not itself provide the mechanism. I just can’t help with how to to that in Xojo because the tool I use has a command to do it, so I don’t use a declare for it either.

but it is not on the 5s/6 or 7 as they have a more narrow screen
and has been this way since those devices came out. The “standard” keyboard varys from device to device, and between portrait and landscape mode… Simple tests using the iOS Simulator will demonstrate this.

Ah, and that’s the difference. On the Plus devices, iOS displays the same keyboard as it does on the iPads.

I just did a quick review on my iPhone 6S and it appears that the common functionality to achieve this is to place a Cancel button to the right of a Search field when it has focus.

When the minimize button isn’t available, you can swipe the keyboard away. Swipe starting at the top of the keyboard to the bottom of the screen.

Not necessarily, Many stock apps have implemented that but it is not inherent to text fields or the stock keyboard.

If your controls are in a UIScrollView, you can set the keyboard dismiss mode of the scroll view as described here starting with iOS 7.

My Solution to hide keyboard on iPhone:

If you have a SearchBar in your view:

SearchBar1:
Sub GotFocus() Handles GotFocus
if isIPad = false then
if RightNavigationToolbar.Count = 0 then
Dim button As iOSToolButton
// Set up title bar buttons
button = iOSToolButton.NewDone(HideKeyboard32)
button.Tag = “Fertig”
RightNavigationToolbar.Add(button)
end if
end if
End Sub

View1:
Sub ToolbarPressed(button As iOSToolButton) Handles ToolbarPressed
if isIPad = false then
UISearchBar1.ClearFocus
RightNavigationToolbar.RemoveByIndex(0)
end if
End Sub

In a global Module:
Public Sub ClearFocus(extends c as iOSControl)
Declare Sub resignFirstResponder Lib “Foundation.Framework” selector “resignFirstResponder”(obj_id As Ptr)
resignFirstResponder(c.handle)
End Sub

Information:
HideKeyboard32 is an image which shows a keyboard