-->

UITextField begin dictation

2020-02-10 03:10发布

问题:

I'd like to programmatically put my UITextField input into dictation mode, without requiring the user to bring up and select dictation from the keyboard. Searched the API documentation but can find no solution. Any ideas?

回答1:

This is currently not possible on iOS.

The only place where it is kind of possible is in an app using WatchKit. In WKInterfaceController you can actually use presentTextInputControllerWithSuggestions with nil as parameter which starts dictation input immediately.



回答2:

You have to implement SFSpeechRecognizer, use Accelerate framework to get mic sound level floats and make an animated view yourself. It will look cooler!

Sorry for not providing the code, I think i lost it. Can’t find it on my multiple hard drives :/



回答3:

Yes

With iOS 10 Apple added SFSpeechRecognizer which allows for starting speech recognition without user interaction.