【发布时间】:2016-02-28 23:00:30
【问题描述】:
我试图让 AVSpeech 说出字符串 *combine 中的两个 NSString 并将其传递给 AVSpeech。但只有 *speekone 被传递给 *combine 字符串。所以我只说出第一个字符串。我是在以某种方式声明字符串错误还是需要更改方法?
- (IBAction)UIButtonPlayPressed:(UIButton *)sender{
NSString *speekone = _activity.activityName;
NSString *speektwo = _activity.activityDescription;
NSString *combined = [NSString stringWithFormat:speekone, speektwo];
if (speechPaused == NO) {
//Title for button [self.UIButtonPlay setTitle:@"Pause" forState:UIControlStateNormal];
[self.synthesizer continueSpeaking];
speechPaused = YES;
NSLog(@"playing");
} else {
//Titleforbutton [self.UIButtonPlay setTitle:@"Play" forState:UIControlStateNormal];
speechPaused = NO;
[self.synthesizer pauseSpeakingAtBoundary:AVSpeechBoundaryImmediate];
NSLog(@"paused");
}
if (self.synthesizer.speaking == NO) {
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:combined];
[self.synthesizer speakUtterance:utterance];
【问题讨论】:
标签: objective-c iphone avspeechsynthesizer