#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface Annotation : NSObject<MKAnnotation>
@property(nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString * title;
@property ( nonatomic, copy)NSString * subtitle;
- (void)textToSpeak:(NSString * )theString;
@end
#import "Annotation.h"
#import <AVFoundation/AVFoundation.h>
@implementation Annotation
@synthesize coordinate, title, subtitle;
-(void)textToSpeak:(NSString *)theString{
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:theString ];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US" ];
utterance.rate = 0.70*AVSpeechUtteranceDefaultSpeechRate;
AVSpeechSynthesizer *synth= [[AVSpeechSynthesizer alloc]init];
[synth speakUtterance:utterance ];
}@end
//我有一个简单的注释类。在我的ViewController.m中,我可以根据需要显示所有引脚。问题是我想在每次单击特定引脚时执行操作。说出标题名称的动作。任何指导都会有用。谢谢!