iOS 语音

#import <AVFoundation/AVFoundation.h>

@property (nonatomic, strong) AVSpeechSynthesizer *synthesizer;

 

- (void)viewDidLoad

{

    [super viewDidLoad];

    

    self.synthesizer = [[AVSpeechSynthesizer alloc] init];

}

 

- (void)say:(UIButton*)sender {

 

    AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:self.textField.text];

    [self.synthesizer speakUtterance:utterance];

}

posted @ 2016-07-15 09:56  tongyuling  阅读(99)  评论(0编辑  收藏  举报