ios - AVSpeechSynthesis 结束

标签 ios objective-c ios7 avspeechsynthesizer

您好,我正在使用 AVSpeechSynthesizer 和 AVSpeechUtterance 构建一个 iOS 7 应用程序,我想弄清楚合成何时完成。更具体地说,我想在合成结束时更改播放/暂停按钮的外观。 有人可以帮我理解在合成结束时是否调用了某种方法? 提前致谢

最佳答案

设置AVSpeechSynthesizerdelegate属性并实现如下委托(delegate)方法:

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didFinishSpeechUtterance:(AVSpeechUtterance *)utterance {
    //do whatever you need to do
}

您可能还对 speechSynthesizer:didCancelSpeechUtterance: 委托(delegate)方法感兴趣,如果您以编程方式停止说话(例如,在按下按钮后)。

关于ios - AVSpeechSynthesis 结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25294893/

相关文章:

ios - 为什么我的 UINavigtionController 栏只有在我覆盖它时才会在 iOS 7 上错误定位?

ios - IOS事件后是否可以触发本地通知?

ios - 是什么让 UITableView 表现得像这样

objective-c - NSNumber 作为 NSDictionary 的键

objective-c - 字典范围?

ios - 在 iOS 中使用 ARC 对 dealloc 进行单元测试

ios - UICollectionView 水平滚动,数据从左向右流动

iphone - 在 iOS 中更改句子部分文本的颜色

ios - 无法从iPhone上的Xcode启动应用

ios - 警告 : The Copy Bundle Resources build phase contains this target's Info. plist 文件