我正在开发一个使用地图工具包的iOS 7应用程序,我可以为用户提供路线和pot方向。我试图重现苹果地图应用程序在开始一次旅行时的工作方式,声音出现并讲述步骤,以及相机的移动。我不知道这是不是可能的,我在哪里可以找到公开它的类。
谢谢。
发布于 2014-03-22 23:52:12
关于叙述,我不知道。但是为了跟踪用户和相机的移动,我使用了这个库:https://github.com/100grams/CoreLocationUtils
有很多帮手,我相信它能帮到你;)
要旋转视图,必须开始标题,如下所示:
// some code
[self.locationManager startUpdatingHeading];
// some code然后,实现这个委托方法:
-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
if (newHeading.headingAccuracy > 0 && abs(self.over-newHeading.trueHeading) > 3) {
CGFloat north = -1.0f * M_PI * (newHeading.trueHeading) / 180.0f;
CGFloat bearing = -1.0f * M_PI * (newHeading.trueHeading-self.bearing) / 180.0f;
/* do some verifications here
you can make the rotation here using CGAffineTransformMakeRotation(north)
or CGAffineTransformMakeRotation(bearing )
*/
self.over = newHeading.trueHeading;
}
}最后,在这个委托方法中,您可以使用前面提到的库(前面提到的)获得两个坐标之间的方位值:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *newLocation = [locations lastObject];
self.currentUserLocation = newLocation;
// set the target location...
self.bearing = [CLLocation directionFromCoordinate:self.currentUserLocation.coordinate toCoordinate:self.targetLocation.coordinate];
}希望这将对您有所帮助;)
发布于 2014-03-23 00:00:08
这是苹果地图应用程序的私有功能。您可以只使用地图或自己创建此要素。
发布于 2014-03-31 04:10:12
查看OpenEars中的旁白选项。
在iOS 7和更高版本中,MKMapCamera及其动画功能将极大地帮助您在地图视图上进行实际的单步执行。
https://stackoverflow.com/questions/22579476
复制相似问题