IOS 如何隐藏键盘顶部的顶栏(带有完成按钮)?

IOS how to hide the top bar (with done button) on the top of the keyboard?

我有一个 UITextField,当显示键盘时,它们位于键盘顶部的一个带有“done”按钮的栏中。

这个完成按钮完全没用,首先它复制了键盘上已经存在的完成按钮,其次它不会触发事件 ShouldReturn 很难用它来捕捉任何动作。

我也在 iphone 5 + ios 9 上看到了这个按钮,但我在 ipad pro + ios 10

上没有看到它

我正在使用 delphi,我不知道这是否重要(我的 iphone 5 上的其他应用不是用 delphi 制作的,没有这个 "done" 酒吧所以也许是)

好的,我找到问题了。当我看到按钮的标题(完成)在法语 iphone 上没有改变时,我很怀疑。 apple 不会犯这么可怕的错误,但 emb 团队通常会犯这种错误 :( 是的,这个栏是由 delphi 制作的!不要问我为什么他们默认会做出如此可怕的想法,但他们做到了...它没有显示在 ipad 中,因为 :

procedure TCocoaVirtualKeyboardService.ApplicationEventHandler(const Sender: TObject; const M: TMessage);
begin
  if (M is TApplicationEventMessage) and ((M as TApplicationEventMessage).Value.Event = TApplicationEvent.FinishedLaunching) then
  begin
    FToolbarEnabled := not IsPad;
    FHideButtonVisible := FToolbarEnabled;
  end;
end;

真的很棒 :(

因此您可以通过执行以下操作来禁用工具栏:

if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardToolbarService, aVirtualKeyboardToolbarService) then aVirtualKeyboardToolbarService.SetToolbarEnabled(False);

让这个无用又丑陋的工具栏默认启用真是白痴:(