Highlight text while Text to Speech is running

前端 未结 1 1051
清酒与你
清酒与你 2021-01-03 02:35

I am developing an app for ipad in which i want to add functionality as below:-

\"enter

相关标签:
1条回答
  • 2021-01-03 03: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.

    0 讨论(0)
提交回复
热议问题