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?
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
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’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.
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.
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