【发布时间】:2011-06-13 07:32:23
【问题描述】:
有谁知道如何根据我当前的标题放置指向特定注释的箭头。例如;当当前标题与注释的坐标相同时,我希望箭头是垂直的。 我通过贝宝向为我做这件事的人提供 50 美元 看看下面的图片;
。
【问题讨论】:
-
我完全知道如何使用相关的三角函数。
标签: iphone ios4 compass-geolocation cllocationmanager cllocation
有谁知道如何根据我当前的标题放置指向特定注释的箭头。例如;当当前标题与注释的坐标相同时,我希望箭头是垂直的。 我通过贝宝向为我做这件事的人提供 50 美元 看看下面的图片;
。
【问题讨论】:
标签: iphone ios4 compass-geolocation cllocationmanager cllocation
听起来您正在尝试与Using lattitude and longitude of the current location and destination location , how can we get the direction in iphone 执行相同的操作,获取当前位置和某个目的地之间的航向,然后将该航向与您当前的航向进行比较以确定箭头应朝向的方向。
【讨论】:
您不能使用屏幕坐标设置箭头旋转,然后旋转包含地图和箭头的视图,以便始终朝北吗?
【讨论】:
你可以试试这样的:
- (void) updateHeading
{
[locationManager startUpdatingHeading];
locationManager.headingFilter = kCLHeadingFilterNone;
}
- (void) locationManager:(CLLocationManager*)manager didUpdateHeading:(CLHeading*)newHeading
{
heading = newHeading.trueHeading;
heading += -90.0 * roll;
NSLog(@"Your Heading: %@", heading);
NSLog(@"magneticHeading: %f", newHeading.magneticHeading);
NSLog(@"trueHeading: %f", newHeading.trueHeading);
}
另外,请参阅 CLHeading Class Reference 中的 magneticHeading 和 truHeading
【讨论】: