在iOS上向地图添加音频 [英] Add audio to Map on iOS

查看:88
本文介绍了在iOS上向地图添加音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有一张地图,上面有几个非常接近的点.现在,当用户点击注释时,会弹出一个带有位置名称的弹出窗口.我如何才能播放有关该位置的音频?

I have a map right now with several points on it that are quite close to each other. Right now when a user taps the annotation a little pop up occurs with the location name on it. How could I have it so that a piece of audio about that location plays?

我对暂停按钮等还不是很着迷,现在我想知道如何在其中实现音频!

I'm not too fussed about pause buttons etc yet, right now I want to know how I'd implement audio into this!

推荐答案

使用

http://jonathanfield.me/avspeechsynthesizer-ios-text- speech-ios-7/

文本到语音的转换

更新:

将委托添加到您的MKMapView.例如,它可能是self

Add delegate to your MKMapView. For example it could be self

self.mapView.delegate = self;

(自身应向MKMapViewDelegate确认).并实现委托的方法

(self should confirm to MKMapViewDelegate). And implement delegate's method

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)anView
{
    AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
    AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:anView.annotation.title];
    [utterance setRate:0.7];
    [synthesizer speakUtterance:utterance];
}

这篇关于在iOS上向地图添加音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆