Objective-c:如何从位置服务中查找航向(方向)?

发布于 2024-11-27 08:47:12 字数 1305 浏览 0 评论 0原文

我正在研究位置服务,并希望从位置服务获取标题,我拥有所有所需的属性,例如纬度、经度等,但我也想找到方向(标题),

 (void)locationUpdate:(CLLocation *)location {
    locationLable.text = [location description];
    CLLocationCoordinate2D coordinate = [location coordinate];
    NSLog(@"This is location   %@",[location description]);
    NSLog(@"Lattitude          =   %@",[NSString stringWithFormat:@"%f", coordinate.latitude]);
    NSLog(@"Langitude          =   %@",[NSString stringWithFormat:@"%f", coordinate.longitude]);
    NSLog(@"Altitude           =   %@",[NSString stringWithFormat:@"%gm", location.altitude]);
    NSLog(@"horizontalAccuracy =   %@",[NSString stringWithFormat:@"%gm", location.horizontalAccuracy]);
    NSLog(@"verticalAccuracy   =   %@",[NSString stringWithFormat:@"%gm", location.verticalAccuracy]);
    NSLog(@"Speed   =   %@",[NSString stringWithFormat:@"%gm", location.speed]);

}


- (void)headingUpdate:(CLHeading *)heading {
    NSLog(@"This is heading   %@",[heading description]);

}

- (void)viewDidLoad {
    locationController = [[MyCLController alloc] init];
    locationController.delegate = self;
    [locationController.locationManager startUpdatingLocation];
    [locationController.locationManager startUpdatingHeading];
}

我找到了一些线索可以从 CLHeading 获取它,但仍然无法从中获取它CL 标题。我正在使用上面的代码

Iam working on Location serves and want o get heading from location services, I have all desired attributes e.g. latitude, longitude etc but I want to find Direction (heading) too

 (void)locationUpdate:(CLLocation *)location {
    locationLable.text = [location description];
    CLLocationCoordinate2D coordinate = [location coordinate];
    NSLog(@"This is location   %@",[location description]);
    NSLog(@"Lattitude          =   %@",[NSString stringWithFormat:@"%f", coordinate.latitude]);
    NSLog(@"Langitude          =   %@",[NSString stringWithFormat:@"%f", coordinate.longitude]);
    NSLog(@"Altitude           =   %@",[NSString stringWithFormat:@"%gm", location.altitude]);
    NSLog(@"horizontalAccuracy =   %@",[NSString stringWithFormat:@"%gm", location.horizontalAccuracy]);
    NSLog(@"verticalAccuracy   =   %@",[NSString stringWithFormat:@"%gm", location.verticalAccuracy]);
    NSLog(@"Speed   =   %@",[NSString stringWithFormat:@"%gm", location.speed]);

}


- (void)headingUpdate:(CLHeading *)heading {
    NSLog(@"This is heading   %@",[heading description]);

}

- (void)viewDidLoad {
    locationController = [[MyCLController alloc] init];
    locationController.delegate = self;
    [locationController.locationManager startUpdatingLocation];
    [locationController.locationManager startUpdatingHeading];
}

I found some clue to get it from CLHeading but still unable to get it from CLHeading. I am using the above code

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南城旧梦 2024-12-04 08:47:12

阅读 http://developer.apple.com /library/ios/#DOCUMENTATION/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html :)
我想你应该使用 trueHeading,我想..

真实标题

相对于正北的航向(以度为单位)。 (只读)
@property(只读,非原子)CLLocationDirection trueHeading

Read http://developer.apple.com/library/ios/#DOCUMENTATION/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html :)
I think you should use trueHeading, I guess..

trueHeading

The heading (measured in degrees) relative to true north. (read-only)
@property(readonly, nonatomic) CLLocationDirection trueHeading

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文