Jor*_*n H 1 uigesturerecognizer ios ios-app-extension custom-keyboard
iOS 10中添加了一个新API,用于显示用户可以切换到的其他键盘列表 - 用户在系统键盘上长按地球仪时显示的相同列表.该功能的声明如下:
func handleInputModeList(from view: UIView, with event: UIEvent)
我的问题是,生成UIEvent供应的正确方法是什么?我打算用a来调用这个函数,UILongPressGestureRecognizer但这个API没有透露UIEvents.
我这是错误的做法.无需自定义手势处理.如标题中所述,应该向要触发它的控件添加目标操作,如下所示:
Objective-C的:
[keyboardButton addTarget:self action:@selector(handleInputModeListFromView:withEvent:) forControlEvents:UIControlEventAllTouchEvents];
迅速:
keyboardButton.addTarget(self, action: #selector(handleInputModeList(from:with:)), for: UIControlEvents.allTouchEvents)
| 归档时间: |
|
| 查看次数: |
851 次 |
| 最近记录: |