如何覆盖 iOS 9 虚拟键盘上的扩展键盘工具栏?

How can I override the extended keyboard toolbar on the iOS 9 virtual keyboard?

iOS9 中的虚拟键盘带来了撤消、重做和粘贴控件。我注意到在我的应用程序中,它们总是相同的,但在 Safari 和其他应用程序中,它们在自定义方面有所不同。我已经有一个自定义工具栏作为 inputAccessoryView,与 iOS 提供的控件相比,我宁愿把它放在那里。我环顾四周,但看不到任何可以用我的观点覆盖它的东西。有办法吗?

在 Luke 对原始 post 的评论中,他将 UITextInputAssistantItem 描述为私有 API。 class 确实还没有出现在 iOS 9 SDK 文档中,但确实出现在 iOS 9 release notes, and was introduced at WWDC (session 107 中;搜索"assistant"), 好像还可以使用和讨论。

以下是 Apple 员工在其 public 论坛上提供的一些 sample code

NSArray barButtonItems = @[ /* Create UIBarButtonItems and place them here */ ];  
UIBarButtonItem representativeItem = // This is optional, if present when there isn't enough room on the bar, the group will be replaced with this item  
UIBarButtonItemGroup *group = [[UIBarButtonItemGroup alloc] initWithBarButtonItems:barButtonItems representativeItem:representativeItem]  
textView.inputAssistantItem.leadingBarButtonGroups = @[ group ]; // replace the items on the bar. Alternatively you can append this group and get the default leading items with this extra group