首页 > 解决方案 > 使用 UIInputViewController 检测硬件键盘事件

问题描述

UITextInputDelegate我需要一种方法来处理在运行 App 键盘扩展时发生的事件和修改文本。

目前我可以处理键盘箭头,因为它们会改变光标位置,但显然按下的键不会改变任何东西。

可能没有设计,但我想知道,我试过了

@protocol UITextInputDelegate <NSObject>

- (void)selectionWillChange:(nullable id <UITextInput>)textInput;
- (void)selectionDidChange:(nullable id <UITextInput>)textInput;
- (void)textWillChange:(nullable id <UITextInput>)textInput;
- (void)textDidChange:(nullable id <UITextInput>)textInput;

标签: iosswiftkeyboard-eventscustom-keyboard

解决方案


推荐阅读