Objective-c:如何从位置服务中查找航向(方向)?
我正在研究位置服务,并希望从位置服务获取标题,我拥有所有所需的属性,例如纬度、经度等,但我也想找到方向(标题),
(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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读 http://developer.apple.com /library/ios/#DOCUMENTATION/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html :)
我想你应该使用 trueHeading,我想..
Read http://developer.apple.com/library/ios/#DOCUMENTATION/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html :)
I think you should use trueHeading, I guess..