Highlight text while Text to Speech is running

感情迁移 提交于 2019-11-30 14:48:21

You can make use of the brilliant text-to-speech library inbuilt with iOS 7 onwards called AVSpeechSynthesizer.

You can control the speech as well as get notifications of it's progress using the AVSpeechSynthesizer delegate methods. The method that should help you achieve your desired functionality should be the speechSynthesizer:willSpeakRangeOfSpeechString:utterance: method.

Have a look at the AVSpeechSynthesizer as well as the AVSpeechSynthesizerDelegate API reference.

This post by Matt Thompson on NSHipster features the exact same functionality with an example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!