I'm using a TTMSFMXNativeUICollectionViewTemplateTextField when editing on an iPad the keyboard hide/collapse button works as expected but on an iPhone the Done button doesn't do anything.
the done button is added programmatically in the FireMonkey framework which hooks onto the virtual keyboard. (FMX.VirtualKeyboard.iOS.pas) this hooking only works for FireMonkey controls.
This was just for clarification that it's the code from the FireMonkey source that interferes with this process.
on iPad, the done button isn't created and thus it doesn't interferes with the virtual keyboard. the virtual keyboard is different, and has an additional button to close the keyboard. It could be possible that you will have to set the focus to a FireMonkey control when starting the editing on the native UITextView control. The OnItemTextViewDidBeginEditing event could be used for this.
The done button is something that is added hardcoded by the FireMonkey framework. As FireMonkey interferes with this process to support FireMonkey controls there is no way to intercept this event, or hide the done button. We will further investigate this here but please understand that is a technical issue that we'll have to overcome.
Please note that the default virtual keyboard on iOS 7/8 for iPhone does not contain a done key. The done button as explained in the previous posts is added by Embarcadero which intercepts the virtual keyboard handling, but there is no way to intercept this from a native control.
The only workaround to hide the keyboard is to change the return key type directly on the native control which will change the return key to a done key and clicking it will hide the keyboard.
I found this thread because I had the same problem. I have solved with the procedure below, which hides this default FMX toolbar on the keyboard. Now I can create my own toolbar to the keyboard (simply use the iCL UIToolbar implementation) and assign it to the keyboard for a textfield using this line:
You are welcome. I actually have a supplement for this, because I had big problems hiding the keyboard again. The normal way using Objective-C would be to call:
MyTMSNativeUITextField.TextField.endEditing(true)
However, this only hides the custom toolbar of the keyboard (which indicates that the textfield actually stopped editing), but the keyboard remains open.
After hours of experimenting and testing, I found a way. Simply call this function after the EndEditing function above: