【问题标题】:How to detect that the user has used speech input in iOS?如何检测用户在 iOS 中使用了语音输入?
【发布时间】:2013-03-04 19:36:29
【问题描述】:

我想检测用户何时使用 iOS 键盘麦克风向 UITextField 添加文本。因此,在键盘出现进行文本输入后,只要他们使用听写麦克风一次,就会设置一个标志,指示他们已使用语音输入。出于使用分析的目的,我需要这样做。

我尝试根据这个捕获dictationRecordingDidEnd

https://developer.apple.com/documentation/uikit/uitextinput

这里的作者遇到了同样的问题: dictationRecordingDidEnd never called

因为该方法似乎永远不会执行。还有其他检测语音输入的方法吗?

【问题讨论】:

    标签: ios speech-recognition text-to-speech uitextinput


    【解决方案1】:

    MyThis 是采用的协议,因此您需要重写该方法。这对我在 iOS 8.1.1 下运行很有用:

    #import <UIKit/UIKit.h>
    
    @interface MyTextField : UITextField
    
    @end
    
    
    #import "MyTextField.h"
    
    @implementation MyTextField
    
    - (void) dictationRecordingDidEnd {
        printf("dictationRecordingDidEnd\n");
    }
    
    @end
    

    【讨论】:

    • 希望这不是私有方法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-28
    • 2018-12-31
    • 1970-01-01
    • 2022-08-02
    • 2021-10-22
    • 1970-01-01
    • 2012-09-22
    相关资源
    最近更新 更多