iOS 文字阅读、自动读英语、超级简单。
2018-03-07 本文已影响32人
JohnayXiao
#import <AVFoundation/AVFoundation.h>
// 点击事件里读文字
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
AVSpeechSynthesizer *synthesize = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:@"Will you marry me ?"];
[synthesize speakUtterance:utterance];
}