UITextField begin dictation

2020-02-10 03:12发布

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?

3条回答
兄弟一词,经得起流年.
2楼-- · 2020-02-10 03:24

Yes

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

查看更多
兄弟一词,经得起流年.
3楼-- · 2020-02-10 03:35

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 :/

查看更多
女痞
4楼-- · 2020-02-10 03:48

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.

查看更多
登录 后发表回答